SQL Server / Plivo REST API / Posting Call Quality Feedback Using API
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OASetProperty @http, 'BasicAuth', 1
EXEC sp_OASetProperty @http, 'Login', '{{auth_id}}'
EXEC sp_OASetProperty @http, 'Password', 'password'
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "call_uuid": "9834029e-58b6-11e1-b8b7-a5bd0e4e126f",
-- "rating": "3",
-- "issues": "ECHO",
-- "Notes": "It's intermittent"
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'call_uuid', '9834029e-58b6-11e1-b8b7-a5bd0e4e126f'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'rating', '3'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'issues', 'ECHO'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Notes', 'It''s intermittent'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://stats.plivo.com/v1/Call/{call_uuid}/Feedback/', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
END
GO
Curl Command
curl -X POST
-u '{{auth_id}}:password'
-d '{
"call_uuid":"9834029e-58b6-11e1-b8b7-a5bd0e4e126f",
"rating":"3",
"issues":"ECHO",
"Notes":"It\'s intermittent"
}'
https://stats.plivo.com/v1/Call/{call_uuid}/Feedback/
Postman Collection Item JSON
{
"name": "Posting Call Quality Feedback Using API",
"request": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"call_uuid\":\"9834029e-58b6-11e1-b8b7-a5bd0e4e126f\",\n \"rating\":\"3\",\n \"issues\":\"ECHO\",\n \"Notes\":\"It's intermittent\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://stats.plivo.com/v1/Call/{call_uuid}/Feedback/",
"protocol": "https",
"host": [
"stats",
"plivo",
"com"
],
"path": [
"v1",
"Call",
"{call_uuid}",
"Feedback",
""
]
},
"description": "This method allows you to post feedback for calls. Call quality feedback information received through this API is accessible on the Call Debug UI. Aggregated reports are available for analyses on the Call Insights Reporting Dashboard.\n\nBelow is the list of arguments that can be passed in this API request, more information can be found [here](https://www.plivo.com/docs/voice/api/call#post-feedback)\n\n| Arguments | Description | Required/Conditional/Optional |\n| :--- | :----: | ---: |\n| call_uuid |The call uuid of the call for which feedback is being posted.| Required |\n| rating | Quality rating for the call, allowed values are, float between [1,5]. PS: for integer values both ‘x’ or ‘x.`0’ are accepted. | Required |\n| issues | List of issues observed on the call. One or more of the following:<br />'AUDIO_LAG','BROKEN_AUDIO','CALL_DROPPED','CALLERID_ISSUE','DIGITS_NOT_CAPTURED','ECHO','HIGH_CONNECT_TIME','LOW_AUDIO_LEVEL','ONE_WAY_AUDIO','OTHERS','ROBOTIC_AUDIO' | Required only if rating is <5 <br />|\n| Notes | This is an optional free text field. It can be used to send descriptive feedback for the call.| Optional |"
},
"response": [
{
"name": "Posting Call Quality Feedback Using API",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"call_uuid\":\"9834029e-58b6-11e1-b8b7-a5bd0e4e126f\",\n \"rating\":\"3\",\n \"issues\":\"ECHO\",\n \"Notes\":\"It's intermittent\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://stats.plivo.com/v1/Call/{call_uuid}/Feedback/",
"protocol": "https",
"host": [
"stats",
"plivo",
"com"
],
"path": [
"v1",
"Call",
"{call_uuid}",
"Feedback",
""
]
}
},
"code": 200,
"_postman_previewlanguage": "json",
"header": [
],
"cookie": [
],
"body": "{\n \"message\": \"Feedback has been Posted\",\n \"api_id\": \"97ceeb52-58b6-11e1-86da-77300b68f8bb\",\n \"status\": \"success\"\n}"
}
]
}