Using the dashboard API I have a request that works perfectly in postman but I’m having trouble getting any results when sending from and AWS Lambda Function.
When I use the below code I get “HTTP 400: Bad Request (Unable to create definition from arguments)”
event_dict = str({"event_type":"Activate%20Lesson"})
url = f"https://amplitude.com/api/2/events/segmentation?e={event_dict}&start=20201201&end=20201231&i=1"
payload=''
headers = urllib3.make_headers(basic_auth='XXXXXXXXXXXXX:XXXXXXXXXXXXX')response = http.request('GET',
url,
body = payload,
headers = headers,
retries = False)res_data = response.data
print(headers)
print(res_data)
print(url)
return res_data
When I use below code I get an empty response:
event_dict = str({"event_type":"Activate%20Lesson"})
url = f"https://amplitude.com/api/2/events/segmentation?e={event_dict}&start=20201201&end=20201231&i=1"
payload=''headers = {'Authentication' : 'Basic XXXXXXXXXXXXXXX:XXXXXXXXXXXXXX’}response = http.request('GET',
url,
body = payload,
headers = headers,
retries = False)res_data = response.data
print(headers)
print(res_data)
print(url)
return res_data
Again, when I test this endpoint in Postman I’m getting the JSON response as expected. I could use some input on troubleshooting.