Chilkat Online Tools

PowerBuilder / Plivo REST API / Stop currently active recording

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_Resp
integer li_RespStatusCode

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.BasicAuth = 1
loo_Http.Login = "{{auth_id}}"
loo_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.

// {
//   "URL": "http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3"
// }

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.UpdateString("URL","http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3")

loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Json.EmitSb(loo_SbRequestBody)

loo_Resp = loo_Http.PTextSb("DELETE","https://api.plivo.com/v1/Account/<auth_id>/Call/{call_uuid}/Record/",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    destroy loo_SbRequestBody
    return
end if

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode <> 204 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Response Body:"
    Write-Debug loo_Resp.BodyStr
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_Json
    destroy loo_SbRequestBody
    return
end if

destroy loo_Resp
Write-Debug "Success."


destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody

Curl Command

curl -X DELETE
	-u '{{auth_id}}:password'
	-d '{
    "URL":"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3"
}'
https://api.plivo.com/v1/Account/<auth_id>/Call/{call_uuid}/Record/

Postman Collection Item JSON

{
  "name": "Stop currently active recording",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"URL\":\"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Call/{call_uuid}/Record/",
      "protocol": "https",
      "host": [
        "api",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "Account",
        "{{auth_id}}",
        "Call",
        "{call_uuid}",
        "Record",
        ""
      ]
    }
  },
  "response": [
    {
      "name": "Stop currently active recording",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"URL\":\"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Call/{call_uuid}/Record/",
          "protocol": "https",
          "host": [
            "api",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "Account",
            "{{auth_id}}",
            "Call",
            "{call_uuid}",
            "Record",
            ""
          ]
        }
      },
      "code": 204,
      "_postman_previewlanguage": "Text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}