Skip to content

Instantly share code, notes, and snippets.

@russellbodine
Last active December 27, 2017 21:00
Show Gist options
  • Save russellbodine/27b6528705dc178be0109f553365f665 to your computer and use it in GitHub Desktop.
Save russellbodine/27b6528705dc178be0109f553365f665 to your computer and use it in GitHub Desktop.

Federal Account Spending By Award

Route: /api/v2/federal_accounts/<PK>/spending_by_award/

Method: GET

This route takes a federal_account DB ID and returns the data reqired to visualized the Award Table

Request

{
	"time_period": "year"
	"filters": {
	    "object_classes": [
	    {
	      "major_object_class_name": "Personnel compensation and benefits",
	      "object_class_names": ["Full-time permanent", "Other than full-time permanent", ...]
	    },
	    {
	      "major_object_class_name": "Other"
	    }
	    ],
	    "program_activites": [1, 2, 3],
	    "time_period": [
		{
			"start_date": "2001-01-01",
			"end_date": "2001-01-31"
		}
	    ]
	}
}

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