Urvish | 2024-06-13 21:47:50 UTC | #1
Contact list from Genesys is being downloaded daily basis with following sequence of operation as csv file.
code language : Python
- To get the URI of contact list, we use following API (in python language)
apiinstance.getoutboundcontactlistexport(contactlist_id, download=False)
- Once we get URI , it make simple get request to that URI with bearer token in request header.
request_headers= {'authorization': f'bearer {token}'}
response = requests.get(URIofcontactlist, headers=request_headers)
- The response.content is the CSV content that is saved locally with file name that is derived from contactlist id & name retrieved from *'Content-Disposition'* header of response
filename=getfilenamefromcd_header(response.headers['Content-Disposition'])
writetobucket(bucketFolder, file_name,,response.content,"text/csv",storageClient)
here , we want to know on the response of get request to URI to download CSV will have 'Content-Disposition' header or not going forward.
This is used to decide the file name on which contact list is saved. (i.e. https://httpwg.org/specs/rfc6266.html#header.field.definition )
charlie.conneely | 2024-06-18 16:31:47 UTC | #2
Hi @Urvish
You are missing a step during the export process. The uri in the response from GET /api/v2/outbound/contactlists/{contactListId}/export contains the download ID i.e. "https://api.mypurecloud.com/api/v2/downloads/<download ID>"
You then need to use that ID in a call to GET /api/v2/downloads/{downloadId} to get the real url that you can use to download the CSV file. (you may need to set the query parameter issueRedirect to false)
Hope this helps Charlie
Urvish | 2024-06-18 17:27:19 UTC | #3
Urvish, post:1, topic:26773
getoutboundcontactlist_export
Thank you for reply. I have implemented this since day 1 and currently also I m able to download the CSV file without any issue. (i.e making request to https://api.mypurecloud.com/api/v2/downloads/<download ID> url)
Only observation is that aft 12-Jun night, response to download CSV file is missing [Content-Disposition] header.
U mean even it is working, it need to change ?
tim.smith | 2024-06-18 17:37:19 UTC | #4
This was not an announced change, nor is that header behavior documented that I'm aware of. Please open a case with Genesys Cloud Care if you feel that this is a bug.
Urvish | 2024-06-18 23:09:13 UTC | #5
thank u I will check cloud care.
system | 2024-07-18 23:09:25 UTC | #6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 26773