Skip to content

Instantly share code, notes, and snippets.

@russellbodine
Last active September 1, 2017 16:25
Show Gist options
  • Select an option

  • Save russellbodine/2b433dfbf1b9fe0b526b0f5ddf04c24f to your computer and use it in GitHub Desktop.

Select an option

Save russellbodine/2b433dfbf1b9fe0b526b0f5ddf04c24f to your computer and use it in GitHub Desktop.

Spending By Award Count

Route: /api/v2/search/spending_by_award_count/

Method: POST

This route takes award filters, and returns the number of awards in each award type (Contracts, Loans, Gran.

Request

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

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

{
	"filters": {
	    "award_type_codes": ["A", "B", "C", "D"],
	    "award_ids": [1, 2, 3],
	    "award_amounts": [
		      {
			"lower_bound": 1000000.00,
			"upper_bound": 25000000.00
		      },
		      {
			"upper_bound": 1000000.00
		      },
		      {
			"lower_bound": 500000000.00
		      }
    	     ]
	}
}

Response (JSON)

{
    "results": 
        {"contracts": 0, "grants": 0, "direct_payments": 0, "loans": 0, "other": 0}
    

Errors

Possible HTTP Status Codes:

  • 400 : Missing parameters or limit is not a valid, positive integer
  • 500 : All other errors
{
  "detail": "Sample error message"
}

Other Search Filters

https://github.com/fedspendingtransparency/usaspending-website/wiki/Award-Search-Visualizations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment