Return 400 status response when requesting unrevealed account data

Description

Goal

As an API user, I want the API to return a 400 response (“Bad Request”) when I request data from a period that has a submission reveal date that is in the future.

Background

Because of how submissions are loaded to USASpending from Broker, we are re-organizing how we are updating the submission_reveal_date. As part of that work we also want to make the response to requesting periods that haven’t been revealed yet to be consistent across the API.

Acceptance Criteria

  1. As an API user, I want any API endpoint I use that has a fiscal_period or fiscal_quarter parameter to return an HTTP 400 “Bad Request” response if I request a period/quarter that does not have a submission_reveal_date that has already passed

  2. Unit tests/API contracts updated accordingly

Testing Notes

  • Example endpoint that uses fiscal_period - /api/v2/reporting/agencies/overview/?fiscal_year=2021&fiscal_period=12

Tech Approach

  • Create list of API endpoints that take a fiscal period/quarter as a parameter

  • Check what response those endpoints are currently returning when an invalid/future fiscal period is being selected

  • Make changes to any endpoints that are not currently returning a `400` response.

    • Probably want to make a function that will return the last valid fiscal_period/fiscal_quarter

Questions

  • Do we want to return a 400 or a 422 as the response?

    • Tinyshield could be used for 422, do we want to use tinyshield?

  • Keith: Probably not a tinyshield situation

Activity

Show:
Melissa Plooksawasdi
April 22, 2021, 9:42 PM

Verified on Postman that the API request in QAT returns a 400 response for fiscal year/period that does not have a submission_reveal_date that has already passed. (See screenshot)

/api/v2/reporting/agencies/overview/?fiscal_year=2021&fiscal_period=12

Seth Stoudenmier
April 13, 2021, 7:23 PM

PR:

Done

Epic Link

Sprint

None

Assignee

Unassigned

Reporter

Emily Brents

Components

Priority

Medium

Story Points

3