Brian_Spencer | 2020-02-18 16:41:01 UTC | #1
Does anyone have experience using https://developer.mypurecloud.com/api/rest/v2/quality/#put-api-v2-quality-surveys-scorable and willing to share a sanitized example of a request body that worked? I'm getting a 200 but unable to either see in progress results or finish a survey entirely.
Thanks, Brian
vchhoa | 2020-03-17 17:29:05 UTC | #2
Hello @Brian_Spencer , Did you manage to successfully score a survey via API ?
Cheers, Valéry
Brian_Spencer | 2020-03-17 17:47:02 UTC | #3
Thanks for following up, @vchhoa. No, I have not. Would love an example if someone has succeeded.
vchhoa | 2020-03-17 20:27:01 UTC | #4
Just succeeded !!!!
First step: Get a survey as an end-customer, for the purposes of scoring it
Ex of call : https://api.{{environment}}/api/v2/quality/surveys/scorable?customerSurveyUrl=https%3A%2F%2Fapps.mypurecloud.ie%2Fquality-forms%2F%23%2Fsurveycodes%2FZmQxMDdjMGMtY2Q4Mi00ZjE1LWFhNTQtNjFiNjU3MDhlMzhh
Remark the SurveyUrl format where the special characteres should be replace by HTML code
It return the survey :
{ "id": "16a39e4d-def8-43a4-ac03-347c1ea9d429", "surveyForm": { "id": "194265dd-af81-41ae-a54f-8c5127c9c7a5", "name": "Company A: Customer (dis)satisfaction", "modifiedDate": "2020-01-10T14:55:51.493Z", "published": true, "disabled": false, "contextId": "0135b5ca-88b6-4370-8ce1-f2e47074952d", "language": "en-US", "header": "\n\n\nYour point of view is more than important for us!", "footer": "As your are in the center of our concerns, your anwsers invaluable. Thanks to share them with us.\n\n\n", "questionGroups": [ { "id": "5e7dd7ba-3144-4f12-b7fe-71c7a56836b8", "name": "Please share with us your feelings", "type": "questionGroup", "naEnabled": false, "questions": [ { "id": "f7069f3b-46bc-47b4-8a25-c12503812a18", "text": "Please rate the quality of service you received from our company today", "helpText": "", "type": "multipleChoiceQuestion", "naEnabled": false, "answerOptions": [ { "id": "bebcae3a-71dd-4a50-a183-7c031a749e54", "text": "1 Very dissatisfied", "value": 1 }, { "id": "f3c8a02f-41f0-4980-8c14-b74b97a82468", "text": "2", "value": 2 }, { "id": "2f518e48-17ef-42b4-ab7e-7f2d6941d2ed", "text": "3", "value": 3 }, { "id": "3f7ff3d1-02a6-4cd0-8db2-4243684d22a7", "text": "4", "value": 4 }, { "id": "5344fde8-9e51-4182-982f-41fa3d517bd4", "text": "5 Very satisfied", "value": 5 } ] }, { "id": "bede04cf-b6fe-4909-b9b3-f2472f251136", "text": "How easy was it to solve your problem with our company today ?", "helpText": "", "type": "multipleChoiceQuestion", "naEnabled": false, "answerOptions": [ { "id": "aa2281ba-a0a4-42de-8049-476e0b702ee7", "text": "1 Very dissatisfied", "value": 1 }, { "id": "3dd49eb3-52cf-4531-87d8-b45b051567ef", "text": "2", "value": 2 }, { "id": "49a9fc87-fe74-42fa-a1ee-77d06bff1ba8", "text": "3", "value": 3 }, { "id": "e305ec98-433f-4177-bd00-d2eacc1db927", "text": "4", "value": 4 }, { "id": "6d3405d8-335d-45e6-ae68-94fb0be58ba3", "text": "5 Very satisfied", "value": 5 } ] }, { "id": "c7dc869f-b1c1-4298-86a2-b655cb277cbe", "text": "How likely are you to recommend our company to a friend or colleague ?", "helpText": "", "type": "npsQuestion", "naEnabled": false, "maxResponseCharacters": 250 } ] } ], "selfUri": "/api/v2/quality/publishedforms/surveys/194265dd-af81-41ae-a54f-8c5127c9c7a5" }, "status": "InProgress", "selfUri": "/api/v2/quality/surveys/scorable" }
Second Step: Update a survey as an end-customer, for the purposes of scoring it.
Ex of call: https://api.{{environment}}/api/v2/quality/surveys/scorable?customerSurveyUrl=https%3A%2F%2Fapps.mypurecloud.ie%2Fquality-forms%2F%23%2Fsurveycodes%2FZmQxMDdjMGMtY2Q4Mi00ZjE1LWFhNTQtNjFiNjU3MDhlMzhh
Body:
{ "name": "Michel", "surveyForm": { "name": "Company A: Customer (dis)satisfaction", "language": "en-US" }, "status": "Finished", "answers": { "questionGroupScores": [ { "questionGroupId": "5e7dd7ba-3144-4f12-b7fe-71c7a56836b8", "questionScores": [ { "questionId": "f7069f3b-46bc-47b4-8a25-c12503812a18", "answerId": "5344fde8-9e51-4182-982f-41fa3d517bd4" }, { "questionId": "bede04cf-b6fe-4909-b9b3-f2472f251136", "answerId": "6d3405d8-335d-45e6-ae68-94fb0be58ba3" }, { "questionId": "c7dc869f-b1c1-4298-86a2-b655cb277cbe", "npsScore": 10 } ] } ] } }
Brian_Spencer | 2020-03-17 20:01:08 UTC | #5
Bingo! Thanks, Valery... the POST body sample is exactly what I needed. Got it working as well.
@vchhoa, appreciate your collaboration with me!
system | 2020-04-17 20:01:09 UTC | #6
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: 7151