Chilkat Online Tools

VBScript / Plivo REST API / Remove a TollFree number

Back to Collection Items

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

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

set http = CreateObject("Chilkat_9_5_0.Http")

http.BasicAuth = 1
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": "False"
' }

set json = CreateObject("Chilkat_9_5_0.JsonObject")
success = json.UpdateString("unrent","False")

set sbRequestBody = CreateObject("Chilkat_9_5_0.StringBuilder")
success = json.EmitSb(sbRequestBody)

' resp is a Chilkat_9_5_0.HttpResponse
Set resp = http.PTextSb("DELETE","https://api.plivo.com/v1/Account/<auth_id>/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
    outFile.WriteLine(http.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine(resp.StatusCode)
outFile.WriteLine(resp.BodyStr)


outFile.Close

Curl Command

curl -X DELETE
	-u '{{auth_id}}:password'
	-d '{
    "unrent":"False"
}'
https://api.plivo.com/v1/Account/<auth_id>/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/

Postman Collection Item JSON

{
  "name": "Remove a TollFree number",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"unrent\":\"False\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/",
      "protocol": "https",
      "host": [
        "api",
        "plivo",
        "com"
      ],
      "path": [
        "v1",
        "Account",
        "{{auth_id}}",
        "NumberPool",
        "{number_pool_uuid}",
        "Tollfree",
        "{tollfree_number}",
        ""
      ]
    },
    "description": "Removes the tollfree number from the numberpool resource. More information can be found [here](https://www.plivo.com/docs/sms/api/numberpool#list-all-tollfree)\n\n| Arguments   | Description | Required/Conditional/Optional |\n| :---:        |    :----:   |          :---: |\n| unrent     | Default is False if not specified.| Optional  |"
  },
  "response": [
    {
      "name": "Remove a TollFree number",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"unrent\":\"False\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.plivo.com/v1/Account/{{auth_id}}/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/",
          "protocol": "https",
          "host": [
            "api",
            "plivo",
            "com"
          ],
          "path": [
            "v1",
            "Account",
            "{{auth_id}}",
            "NumberPool",
            "{number_pool_uuid}",
            "Tollfree",
            "{tollfree_number}",
            ""
          ]
        }
      },
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
      ],
      "cookie": [
      ],
      "body": "{\n    \"api_id\": \"57936fb0-7ed5-11ea-aa79-0242ac110003\",\n    \"response\": \"success\"\n}"
    }
  ]
}