{"action":"created","issue":{"url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/1322","repository_url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api","labels_url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/1322/labels{/name}","comments_url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/1322/comments","events_url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/1322/events","html_url":"https://github.com/fedspendingtransparency/usaspending-api/issues/1322","id":338008448,"node_id":"MDU6SXNzdWUzMzgwMDg0NDg=","number":1322,"title":"API endpoints not working","user":{"login":"charles0917","id":7693477,"node_id":"MDQ6VXNlcjc2OTM0Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/7693477?v=4","gravatar_id":"","url":"https://api.github.com/users/charles0917","html_url":"https://github.com/charles0917","followers_url":"https://api.github.com/users/charles0917/followers","following_url":"https://api.github.com/users/charles0917/following{/other_user}","gists_url":"https://api.github.com/users/charles0917/gists{/gist_id}","starred_url":"https://api.github.com/users/charles0917/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charles0917/subscriptions","organizations_url":"https://api.github.com/users/charles0917/orgs","repos_url":"https://api.github.com/users/charles0917/repos","events_url":"https://api.github.com/users/charles0917/events{/privacy}","received_events_url":"https://api.github.com/users/charles0917/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-03T18:25:58Z","updated_at":"2018-09-10T03:09:59Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI've tried several of the request examples for the API endpoints but a lot of the don't work.\r\nFor example,\r\n/api/v2/bulk_download/list_monthly_files/ gives \r\n400 Bad Request\r\n/api/v2/search/spending_by_geography/ gives\r\n500 Internal Server Error\r\n\r\nI'm sending POST requests through Python. Is this an issue with the server or my end?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/comments/419775047","html_url":"https://github.com/fedspendingtransparency/usaspending-api/issues/1322#issuecomment-419775047","issue_url":"https://api.github.com/repos/fedspendingtransparency/usaspending-api/issues/1322","id":419775047,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTc3NTA0Nw==","user":{"login":"kenchandev","id":4991363,"node_id":"MDQ6VXNlcjQ5OTEzNjM=","avatar_url":"https://avatars2.githubusercontent.com/u/4991363?v=4","gravatar_id":"","url":"https://api.github.com/users/kenchandev","html_url":"https://github.com/kenchandev","followers_url":"https://api.github.com/users/kenchandev/followers","following_url":"https://api.github.com/users/kenchandev/following{/other_user}","gists_url":"https://api.github.com/users/kenchandev/gists{/gist_id}","starred_url":"https://api.github.com/users/kenchandev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenchandev/subscriptions","organizations_url":"https://api.github.com/users/kenchandev/orgs","repos_url":"https://api.github.com/users/kenchandev/repos","events_url":"https://api.github.com/users/kenchandev/events{/privacy}","received_events_url":"https://api.github.com/users/kenchandev/received_events","type":"User","site_admin":false},"created_at":"2018-09-10T03:09:59Z","updated_at":"2018-09-10T03:09:59Z","author_association":"NONE","body":"I can confirm that the POST endpoints work via cURL.\r\n\r\n```bash\r\n$ curl --request POST --url https://api.usaspending.gov/api/v2/download/accounts --header \"Content-Type: application/json\" --data '{\"account_level\": \"treasury_account\", \"filters\": { \"submission_type\": \"account_balances\", \"fy\": \"2017\", \"quarter\": \"3\" }, \"file_format\": \"csv\"}' | jq '.url' | xargs wget\r\n```\r\n\r\n<img src=\"https://www.dropbox.com/s/5zwsxewrab2b4fp/Screenshot%202018-09-09%2023.02.35.png?raw=1\" />\r\n\r\n```bash\r\n$ curl --request POST --url https://api.usaspending.gov/api/v2/search/spending_by_geography --header \"Content-Type: application/json\" --data '{ \"scope\": \"place_of_performance\", \"geo_layer\": \"state\", \"filters\": { \"recipient_locations\": [{ \"country\": \"ABC\" }] } }'\r\n```\r\n\r\n<img src=\"https://www.dropbox.com/s/i4w4t1fczrga1jm/Screenshot%202018-09-09%2023.02.46.png?raw=1\" />\r\n\r\nMaybe incorrect options were provided?\r\n\r\nThe [documentation](https://api.usaspending.gov/docs/endpoints) is somewhat lacking as it doesn't detail what data to send as the payload for the POST request (along with request headers). I was able to successfully make these requests due to looking at the testing suite (i.e.: https://github.com/fedspendingtransparency/usaspending-api/blob/dev/usaspending_api/search/tests/test_spending_by_geography.py#L12), which I found to be quite useful."}}
{"actor":{"display_login":"kenchandev"}}