Skip to content

Instantly share code, notes, and snippets.

@nmonga91
Last active October 18, 2017 18:59
Show Gist options
  • Save nmonga91/64bae8e99f6579c4d57d7f04f443fa7e to your computer and use it in GitHub Desktop.
Save nmonga91/64bae8e99f6579c4d57d7f04f443fa7e to your computer and use it in GitHub Desktop.
Spending By Award

Route: /api/v2/search/spending_by_award/

Method: POST

This route takes award filters and fields, and returns the fields of the filtered awards.

Request

field: Defines what award variables are returned.

filter: Defines how the awards are filtered. The filter object is defined here.

https://gist.github.com/nmonga91/ba0e172b6d3f2aaf50f0ef1bb5d708bc#recipient-location

limit(OPTIONAL): how many results are returned

page (OPTIONAL): what page of results are returned

sort (OPTIONAL): Optional parameter indicating what value results should be sorted by. Valid options are any of the fields in the JSON objects in the response. Defaults to the first field provided.

order (OPTIONAL): Optional parameter indicating what direction results should be sorted by. Valid options include asc for ascending order or desc for descending order. Defaults to asc.

{
  "filters": {
       "award_type_codes": ["10"],
       "agencies": [
            {
                 "type": "awarding",
                 "tier": "toptier",
                 "name": "Social Security Administration"
            },
            {
                 "type": "awarding",
                 "tier": "subtier",
                 "name": "Social Security Administration"
            },
            {
                 "type": "funding",
                 "tier": "toptier",
                 "name": "Social Security Administration"
            },
            {
                 "type": "funding",
                 "tier": "subtier",
                 "name": "Social Security Administration"
            }
       ],
       "legal_entities": [779928],
       "recipient_scope": "domestic",
       "recipient_locations": [650597],
       "recipient_type_names": ["Individual"],
       "place_of_performance_scope": "domestic",
       "place_of_performance_locations": [60323],
       "award_amounts": [
              {
                  "lower_bound": 1500000.00,
                  "upper_bound": 1600000.00
              }
       ],
       "award_ids": [1018950]
  },
  "fields": ["Award ID", "Recipient Name", "Start Date", "End Date", "Award Amount", "Awarding Agency", "Awarding Sub Agency", "Award Type", "Funding Agency", "Funding Sub Agency"],
  "sort": "Recipient Name",
  "order": "desc"
}

Response (JSON)

{
    "limit": 10,
    "results": [
        {
            "internal_id": 1018950,
            "Award ID": null,
            "Recipient Name": "MULTIPLE RECIPIENTS",
            "Start Date": null,
            "End Date": null,
            "Award Amount": 1573663,
            "Awarding Agency": "Social Security Administration",
            "Awarding Sub Agency": "Social Security Administration",
            "Award Type": "10",
            "Funding Agency": "Social Security Administration",
            "Funding Sub Agency": "Social Security Administration"
        }
    ],
    "page_metadata": {
        "page": 1,
        "hasNext": true
    }
}

Response Fields

  • page: Page # that came in as part of the POST request
  • hasNext: Boolean flags to indicate if the next page exists

Errors

Possible HTTP Status Codes:

  • 400 : Missing parameters or limit is not a valid, positive integer
  • 500 : All other errors
{
  "detail": "Sample error message"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment