Chilkat Online Tools

Xojo / Plivo REST API / Delete a Powerpack

Back to Collection Items

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

Dim http As New Chilkat.Http
Dim success As Boolean

http.BasicAuth = True
http.Login = "{{auth_id}}"
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.

// {
//   "unrent_numbers": "True"
// }

Dim json As New Chilkat.JsonObject
success = json.UpdateString("unrent_numbers","True")

Dim sbRequestBody As New Chilkat.StringBuilder
success = json.EmitSb(sbRequestBody)

Dim resp As Chilkat.HttpResponse
resp = http.PTextSb("DELETE","https://api.plivo.com/v1/Account/<auth_id>/Powerpack/{powerpack_uuid}/",sbRequestBody,"utf-8","application/json",False,False)
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = resp.StatusCode
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode <> 204) Then
    System.DebugLog("Response Header:")
    System.DebugLog(resp.Header)
    System.DebugLog("Response Body:")
    System.DebugLog(resp.BodyStr)
    System.DebugLog("Failed.")

    Return
End If

System.DebugLog("Success.")

Curl Command

curl -X DELETE
	-u '{{auth_id}}:password'
	-d '{
    "unrent_numbers":"True"

}'
https://api.plivo.com/v1/Account/<auth_id>/Powerpack/{powerpack_uuid}/

Postman Collection Item JSON

{
  "name": "Delete a Powerpack",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"unrent_numbers\":\"True\"\n\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Powerpack/{powerpack_uuid}/",
      "protocol": "https",
      "host": [
        "api",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "Account",
        "{{auth_id}}",
        "Powerpack",
        "{powerpack_uuid}",
        ""
      ]
    },
    "description": "Unrent the phone numbers in the Powerpack’s NumberPool from your account. This operation cannot be undone. Below 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/powerpack#delete-a-powerpack)\n\n| Arguments   | Description | Required/Conditional/Optional     |\n| :---        |    :----:   |          ---: |\n| unrent_numbers      | If set to True, then all the phone numbers in the Powerpack's NumberPool will be unrented from the account. Default value is False.| Optional  |"
  },
  "response": [
    {
      "name": "Delete a Powerpack",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"unrent_numbers\":\"True\"\n\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Powerpack/{powerpack_uuid}/",
          "protocol": "https",
          "host": [
            "api",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "Account",
            "{{auth_id}}",
            "Powerpack",
            "{powerpack_uuid}",
            ""
          ]
        }
      },
      "code": 204,
      "_postman_previewlanguage": "Text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}