Download Tool Question....
I am trying to test a connection to USASpending to retrieve award data -- link to award search page here.
I watched the tutorial video on YouTube here
I am trying to do a POST request to this API endpoint.
https://api.usaspending.gov/api/v2/search/spending_by_award/
Documentation for this endpoint is here.
My SEARCH CRITERIA is pretty straightforward:
From Firefox, I from Network/Request the following request. Note: It should be in line with API documentation (as it was generated by the USASpending search page).
{"filters":{"keywords":["ZHEGXL9HYV43"],"time_period":[{"start_date":"2023-10-01","end_date":"2024-09-30"},{"start_date":"2013-10-01","end_date":"2014-09-30"},{"start_date":"2014-10-01","end_date":"2015-09-30"},{"start_date":"2015-10-01","end_date":"2016-09-30"},{"start_date":"2016-10-01","end_date":"2017-09-30"},{"start_date":"2017-10-01","end_date":"2018-09-30"},{"start_date":"2018-10-01","end_date":"2019-09-30"},{"start_date":"2019-10-01","end_date":"2020-09-30"},{"start_date":"2020-10-01","end_date":"2021-09-30"},{"start_date":"2021-10-01","end_date":"2022-09-30"},{"start_date":"2022-10-01","end_date":"2023-09-30"}],"award_type_codes":["A","B","C","D"]},"fields":["Award ID","Recipient Name","Start Date","End Date","Award Amount","Total Outlays","Description","def_codes","COVID-19 Obligations","COVID-19 Outlays","Infrastructure Obligations","Infrastructure Outlays","Awarding Agency","Awarding Sub Agency","Contract Award Type","recipient_id","prime_award_recipient_id"],"page":1,"limit":60,"sort":"Award Amount","order":"desc","subawards":false}
??? QUESTIONS ????
Basic
Advanced:
I tried to replicate the results using an Input Tool with the URL to the endpoint connected to a Download Tool. I did not get the desired results.
The Download Tool was configured as follows:
BASIC took the URL from the Input Tool's URL field. The URL was the same as above.
HEADERS - nothing - This is probably where I messed up.
PAYLOAD
Solved! Go to Solution.
Let my refine my question.
The BASIC question should suffice.
The Advanced questions appear to be addressed by the Bulk Award Download API, which downloads too much.
Sorry for not responding sooner.
This is exactly what I needed to know.
THANK YOU.
Header = Content-Type = application/son
Payload = Take Query String/Body from Field = JSON Payload (or whatever the filed is named)
And the sample JSON Payload is:
I changed limit from 10 to 84 just to see if I could get all the results for 2024. It worked.
From there, filters and fields should just comply with API instructions for this or any of the endpoint.
{
"subawards": false,
"limit": 84,
"page": 1,
"filters": {
"keywords": ["ZHEGXL9HYV43"],
"award_type_codes": ["A", "B", "C"],
"time_period": [{"start_date": "2023-01-01", "end_date": "2024-09-30"}]
},
"fields": [
"Award ID",
"Recipient Name",
"Start Date",
"End Date",
"Award Amount",
"Awarding Agency",
"Awarding Sub Agency",
"Contract Award Type",
"Award Type",
"Funding Agency",
"Funding Sub Agency"
]
}
two quick things - 1) I think another endpoint will give you the total count. You can use that with generate rows/offest logic to limit it to 100 per call - and then to create a mapping to create the actual item number 2) I ran for ["a","b","c"] - i think you want to include "d"