christopher.malm.fcr | 2022-07-12 23:29:59 UTC | #1
Hello, I don't want to use the python SDK. I'm hoping someone can tell me how to set up a simple python post request to get data for a single day. Can get an Oauth token and have been trying different combinations of the below. posturl = 'https://api.mypurecloud.com/api/v2/analytics/conversations/details/jobs' postheaders = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {accesstoken}', } postbody = {
"interval": "2022-06-01T00:00:00.000Z/2022-06-02T00:00:00.000Z"
"start": "2020-03-17T11:00:00.000", "end": "2020-03-17T21:00:00.000", } postpayload = json.dumps({ "interval": "2022-06-01T00:00:00.000Z/2022-06-02T00:00:00.000Z" }) postresponse = requests.request('POST', posturl, headers=postheaders, body=postbody) # jsonpostresponse = postresponse.json()
Any help would be greatly appreciated
anon14299330 | 2022-07-14 14:11:13 UTC | #2
Hi,
To achieve this without the python SDK, take a look at the example code below.
from pprint import pprint
import requests
url = "https://api.mypurecloud.com/api/v2/analytics/conversations/details/jobs"
my_headers = {"Authorization" : "Bearer your_access_token_goes_here"}
body = {"interval": "your_interval_goes_here"}
response = requests.post(url, headers=my_headers, json=body)
pprint(response.json())
Thanks,
Mike
system | 2022-08-14 14:11:15 UTC | #3
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 15484