mikejenks | 2017-03-02 03:19:45 UTC | #1
I have a contact list that I add contacts to for outdial (via the API), these remain in the list after the call has been made. Over time this list will grow and grow. I don't want to delete the list as I am referencing it when I add new contacts to dial.
Is there an easy way to housekeep and remove old contacts from the list? Thanks Mike
tim.smith | 2017-03-02 15:32:55 UTC | #2
You can use DELETE /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId} to remove contacts from the list.
mikejenks | 2017-03-06 20:22:52 UTC | #3
What's the best way to get a list of all the contacts via the API? I have been playing with the export method, but can't seem to get it to return the list
tim.smith | 2017-03-06 21:13:41 UTC | #4
Use POST /api/v2/outbound/contactlists/{contactListId}/export to initiate the export, then GET /api/v2/outbound/contactlists/{contactListId}/export to get the URI to the export file, then download the file at the given URI.
mikejenks | 2017-03-07 03:54:09 UTC | #5
I can't use GET /api/v2/outbound/contactlists/' + listId + '/export?download=true. It complains that "No authentication bearer token specified" if I don't have an Authorisation header and "Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter" if I do.
Using download=false I get the URI returned - but I have problems with the final GET.
If I specify Authorization in a header I get an error: "Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified".
If I don't specify an Authorisation header it returns HTML (not the csv list). This looks like it is the PureCloud login page (as the script src and integrity attributes are identical).
Can you give me details of anything special that I need to set (especially for Authorisation and headers)?
Thanks
tim.smith | 2017-03-07 16:35:07 UTC | #6
The short answer is that there's an issue with the redirect. I've opened CD-4572 for it.
The longer answer is this: The initial request is to a purecloud service. The URL will be something similar to https://public-api.us-east-1.mypurecloud.com/api/v1/downloads/{id}. This service validates your auth token and then redirects you to an AWS S3 bucket. The issue is that the redirect to the file in S3 contains an AWS auth token. When you follow that redirect, the same request is made to the new endpoint. Because you're making the same request (with the auth header) and the redirect contains an AWS token, AWS rejects the message because you have incorrectly provided two methods of authentication.
To work around this, you will have to stop your code from following the redirect and make a new request without an auth header to the S3 URL.
tim.smith | 2017-03-14 19:03:43 UTC | #7
Update: CD-4572 has been closed. To download files, you must use the workaround mentioned above:
tim.smith, post:6, topic:991
To work around this, you will have to stop your code from following the redirect and make a new request without an auth header to the S3 URL.
system | 2017-08-28 19:32:31 UTC | #8
This post was migrated from the old Developer Forum.
ref: 991