Python Request for Analytics Conversations Jobs

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.
post_url = 'https://api.mypurecloud.com/api/v2/analytics/conversations/details/jobs'
post_headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}',
}
post_body = {

"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",
}
post_payload = json.dumps({
"interval": "2022-06-01T00:00:00.000Z/2022-06-02T00:00:00.000Z"
})
post_response = requests.request('POST', post_url, headers=post_headers, body=post_body) #
json_post_response = post_response.json()

Any help would be greatly appreciated

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

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.