Skip to content

Instantly share code, notes, and snippets.

@russellbodine
Last active October 10, 2017 17:50
Show Gist options
  • Select an option

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

Select an option

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

Download v2 API

/v2/bulk_download/awards (POST)

Request

POST a JSON body:

{
	"award_level":[],
	"award_types":[],
	"agency":123,
	"sub_agency":1111,
	"data_type":"action_date",
	"time_period": [
		{
			"start_date": "2001-01-01",
			"end_date": "2001-01-31"
		},
		{
			"start_date": "2001-01-01",
			"end_date": "2001-01-31"
		}
	    ],
	"file_format": "csv"    
    
}
  • filters is a standard Search v2 JSON filter object
    • award_level: defines wether prime awards and/or sub awards are returned. possible results: ["prime_awards","sub_awards"]
    • award_types: award types. ["contracts","grants", "direct_payments", "loans", "other_financial_assistance"]
    • agency: awarding agency autocomplete result (CGAC/FREC). 555
    • sub_agency: (OPTIONAL FIELD) Sub agency autocomplete result, 1111
    • date_type: Which date field to use when sorting by time period. Only one of the following values is allowed. ["action_date", 'initial_report_date', 'last_modified_date']
    • time_period: each based on one or more fiscal year selections OR date range. Dates should be in the following format: YYYY-MM-DD
    • file_format: Type of file returned. (PICK ONE) ["csv", "tsv", "xml"]

Response

{
   "status":"ready",
   "total_rows":null,
   "file_name":"5757660_968336105_awards.zip",
   "total_size":null,
   "total_columns":null,
   "message":null,
   "url":"/Volumes/exlinux/Users/catherine/werk/dataact/usaspending-api/downloads/5757660_968336105_awards.zip",
   "seconds_elapsed":null
}

/v2/bulk_download/accounts (POST)

Request

POST a JSON body:

{
	"account_level":"federal_account",
	"agency":111,
	"federal_account":111,
	"file_submission_type":"A",
	"time_period": [
		{
			"start_date": "2001-01-01",
			"end_date": "2001-01-31"
		}
	]
	"file_format": "csv"    
}
  • filters is a standard Search v2 JSON filter object
    • account_level: defines which type of account to search on. (Pick one) possible results: ["federal_account","treasury_account"]
    • agency: awarding agency autocomplete result. 555
    • sub_agency: (OPTIONAL FIELD) Sub agency autocomplete result, 1111
    • date_type: Which date field to use when sorting by time period. Only one of the following values is allowed. ["action_date", 'initial_report_date', 'last_modified_date']
    • time_period: each based on one or more fiscal year selections OR date range. Dates should be in the following format: YYYY-MM-DD
    • file_format: Type of file returned. (PICK ONE) ["csv", "tsv", "xml"]

Response

{
   "status":"ready",
   "total_rows":null,
   "file_name":"5757660_968336105_awards.zip",
   "total_size":null,
   "total_columns":null,
   "message":null,
   "url":"/Volumes/exlinux/Users/catherine/werk/dataact/usaspending-api/downloads/5757660_968336105_awards.zip",
   "seconds_elapsed":null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment