PowerBuilder / Plivo REST API / Delete an Application
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
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.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.
// {
// "cascade": "true",
// "new_endpoint_application": "77506472664956327"
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("cascade","true")
loo_Json.UpdateString("new_endpoint_application","77506472664956327")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("DELETE","https://api.plivo.com/v1/Account/{auth_id}/Application/{app_id}/",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 '{
"cascade":"true",
"new_endpoint_application":"77506472664956327"
}'
https://api.plivo.com/v1/Account/{auth_id}/Application/{app_id}/
Postman Collection Item JSON
{
"name": "Delete an Application",
"request": {
"method": "DELETE",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"cascade\":\"true\",\n \"new_endpoint_application\":\"77506472664956327\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.plivo.com/v1/Account/{auth_id}/Application/{app_id}/",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{auth_id}",
"Application",
"{app_id}",
""
]
},
"description": "This API would delete the Application permanently.\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/sms/api/message#send-a-message)\n\n| Arguments | Description | Required/Conditional/Optional |\n| :--- | :----: | ---: |\n| cascade | If cascade is set to true, the Endpoints associated with the Application, if any, are also deleted.When set to false, the Endpoints associated with the Application, if any, are not deleted. <br />If a new_endpoint_application has been specified, then the Endpoints are reassociated with the given Application. If a new_endpoint_application is not specified, then the Endpoints remain orphaned. (i.e. not associated with any Application.)cascade is set to true by default when not specified.| Optional |\n| new_endpoint_application | The app_id of the new Application to which the Endpoints should be associated upon deletion of this Application. | Required |"
},
"response": [
{
"name": "Delete an Application",
"originalRequest": {
"method": "DELETE",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"cascade\":\"true\",\n \"new_endpoint_application\":\"77506472664956327\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.plivo.com/v1/Account/{auth_id}/Application/{app_id}/",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{auth_id}",
"Application",
"{app_id}",
""
]
}
},
"code": 204,
"_postman_previewlanguage": "Text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}