May-09-2023, 01:45 PM
Hello,
I am having difficulty pulling data from an API which says that parameter content needs to be application/json. Here is the link to the the api notes http://www.nfib-sbet.org/developers/
Here is the code I have:
Matt
I am having difficulty pulling data from an API which says that parameter content needs to be application/json. Here is the link to the the api notes http://www.nfib-sbet.org/developers/
Here is the code I have:
url = "http://open.api.nfib-sbet.org/rest/sbetdb/_proc/getIndicators" headers = { "Content-Type": "application/json", "app_name": "sbet" } data = { "params": [ { "name": "minYear", "param_type": "IN", "value": 2010 }, { "name": "minMonth", "param_type": "IN", "value": 6 }, { "name": "maxYear", "param_type": "IN", "value": 2010 }, { "name": "maxMonth", "param_type": "IN", "value": 12 }, { "name": "indicator", "param_type": "IN", "value": "OPT_INDEX" } ] } response = requests.post(url, headers=headers, data=json.dumps(data))I keep getting 400 responses. I tried a few slightly different variations but nothing seems to work. I've looked through the api notes and can't figure out what i'm doing wrong. any help would be much appreciated.
Matt