Genesys Cloud Developer Forum

Retrieve content (canned) Response

Hi,

I am trying to retrieve the content (the text) of a response through API.

https://api.{{environment}}/api/v2/responsemanagement/libraries/968e9ece-c425-4031-81e4-f115b1e13d59/

Results in 'created by', 'version' but not the content

https://api.{{environment}}/api/v2/responsemanagement/responses/"968e9ece-c425-4031-81e4-f115b1e13d59

Results in {
"status": 404,
"code": "not.found",
"message": "The response was not found for ID: "968e9ece-c425-4031-81e4-f115b1e13d59",
"contextId": "3c9d6765-24db-45ee-9eae-bec4385ea03e",
"details": [],
"errors": []
}

It looks like you have a quote in your URL path before the GUID. Does it work if you take that out?

Same result without my typo

https://api.{{environment}}/api/v2/responsemanagement/responses/968e9ece-c425-4031-81e4-f115b1e13d59

{
"status": 404,
"code": "not.found",
"message": "The response was not found for ID: 968e9ece-c425-4031-81e4-f115b1e13d59",
"contextId": "6369fa41-9482-4bf8-8508-b328ba35e528",
"details": [],
"errors": []

If the library api returns data given the guid, then it seems like that's the library guid, not the response guid. You can get the list of responses for a given library either via the GET responses API or the query api: https://developer.mypurecloud.com/api/rest/v2/responsemanagement/index.html#postResponsemanagementResponsesQuery

Once you have the response id, the get response api you used will give you the text.

If I Use https://api.{{environment}}/api/v2/responsemanagement/responses

Then I get
{
"status": 400,
"code": "bad.request",
"message": "Missing parameter: libraryId",
"contextId": "9066ce64-cdfa-449e-9f51-7c8e33c65267",
"details": [],
"errors": []
}

If I Use https://api.{{environment}}/api/v2/responsemanagement/libraries

Then I get the complete list

Like:
"entities": [
{
"id": "968e9ece-c425-4031-81e4-f115b1e13d59",
"name": "NLEMail",
"version": 2,
"createdBy": {
"id": "ed7b763b-2d4b-4636-91dc-912dc31d6a34",
"selfUri": "/api/v2/users/ed7b763b-2d4b-4636-91dc-912dc31d6a34"
},
"dateCreated": "2016-11-17T10:08:08.872Z",
"selfUri": "/api/v2/responsemanagement/libraries/968e9ece-c425-4031-81e4-f115b1e13d59"
},

If I Use https://api.{{environment}}/api/v2/responsemanagement/libraries/968e9ece-c425-4031-81e4-f115b1e13d59/

I get details but not the content of the response
{
"id": "968e9ece-c425-4031-81e4-f115b1e13d59",
"name": "NLEMail",
"version": 2,
"createdBy": {
"id": "ed7b763b-2d4b-4636-91dc-912dc31d6a34",
"selfUri": "/api/v2/users/ed7b763b-2d4b-4636-91dc-912dc31d6a34"
},
"dateCreated": "2016-11-17T10:08:08.872Z",
"selfUri": "/api/v2/responsemanagement/libraries/968e9ece-c425-4031-81e4-f115b1e13d59"
}

I Want to retrieve the content (text) of a canned response

In my test environment, these all give me back the texts/content of the responses:
/responsemanagement/responses?pageSize=25&pageNumber=1&libraryId= - list of responses
/responsemanagement/responses/ - single response
/responsemanagement/responses/query with queryPhrase passed in - list of responses

Can you try the above APIs?

I think you have a point around the /responsemanagement/libraries API returning the content/text as well though. We can look into adding that.

Ok checked again and I was mistaken around the libraries API. That one simply returns a list of the libraries that exist in the system. The above 3 APIs are the ones that you can use to retrieve texts for multiple responses or a single response.

For your specific use case, try doing this: /responsemanagement/responses?pageSize=25&pageNumber=1&libraryId=968e9ece-c425-4031-81e4-f115b1e13d59

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