Chilkat Online Tools

TCL / Core Services API / UpdateByoipRange

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

# Use this online tool to generate code from sample JSON: Generate Code to Create JSON

# The following JSON is sent in the request body.

# {
#   "definedTags": {},
#   "displayName": "tempor Excepteur minim culpa",
#   "freeformTags": {}
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateNewObject $json "definedTags"
CkJsonObject_UpdateString $json "displayName" "tempor Excepteur minim culpa"
CkJsonObject_UpdateNewObject $json "freeformTags"

CkHttp_SetRequestHeader $http "opc-request-id" "8wF"
CkHttp_SetRequestHeader $http "Content-Type" "application/json"
CkHttp_SetRequestHeader $http "x-content-sha256" "{{content_sha256}}"
CkHttp_SetRequestHeader $http "Authorization" "{{signature}}"
CkHttp_SetRequestHeader $http "Date" "{{date}}"
CkHttp_SetRequestHeader $http "if-match" "officia sed"

set sbRequestBody [new_CkStringBuilder]

CkJsonObject_EmitSb $json $sbRequestBody

# resp is a CkHttpResponse
set resp [CkHttp_PTextSb $http "PUT" "https://iaas.{{region}}.oraclecloud.com/20160918/byoipRanges/:byoipRangeId" $sbRequestBody "utf-8" "application/json" 0 0]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

delete_CkHttpResponse $resp

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# {
#   "id": "fugiat adipisicing quis anim commodo",
#   "compartmentId": "tempor culpa mollit nisi",
#   "cidrBlock": "laboredese",
#   "lifecycleState": "UPDATING",
#   "validationToken": "nisi",
#   "timeCreated": "2002-03-26T06:43:06.961Z",
#   "definedTags": {},
#   "displayName": "Ut labore in nostrud",
#   "freeformTags": {},
#   "lifecycleDetails": "CREATING",
#   "timeAdvertised": "1959-09-07T20:00:34.371Z",
#   "timeValidated": "2018-04-14T04:07:30.549Z",
#   "timeWithdrawn": "1961-12-25T13:30:04.079Z"
# }

# Sample code for parsing the JSON response...
# Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

set id [CkJsonObject_stringOf $jResp "id"]
set compartmentId [CkJsonObject_stringOf $jResp "compartmentId"]
set cidrBlock [CkJsonObject_stringOf $jResp "cidrBlock"]
set lifecycleState [CkJsonObject_stringOf $jResp "lifecycleState"]
set validationToken [CkJsonObject_stringOf $jResp "validationToken"]
set timeCreated [CkJsonObject_stringOf $jResp "timeCreated"]
set displayName [CkJsonObject_stringOf $jResp "displayName"]
set lifecycleDetails [CkJsonObject_stringOf $jResp "lifecycleDetails"]
set timeAdvertised [CkJsonObject_stringOf $jResp "timeAdvertised"]
set timeValidated [CkJsonObject_stringOf $jResp "timeValidated"]
set timeWithdrawn [CkJsonObject_stringOf $jResp "timeWithdrawn"]

delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbRequestBody
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp

Curl Command

curl -X PUT
	-H "opc-request-id: 8wF"
	-H "if-match: officia sed"
	-H "Content-Type: application/json"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
	-H "x-content-sha256: {{content_sha256}}"
	-d '{
    "definedTags": {},
    "displayName": "tempor Excepteur minim culpa",
    "freeformTags": {}
}'
https://iaas.{{region}}.oraclecloud.com/20160918/byoipRanges/:byoipRangeId

Postman Collection Item JSON

{
  "name": "UpdateByoipRange",
  "request": {
    "method": "PUT",
    "header": [
      {
        "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
        "key": "opc-request-id",
        "value": "8wF"
      },
      {
        "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
        "key": "if-match",
        "value": "officia sed"
      },
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Date",
        "value": "{{date}}",
        "description": "(Required) Current Date",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "{{signature}}",
        "description": "(Required) Signature Authentication on Authorization header",
        "type": "text"
      },
      {
        "key": "x-content-sha256",
        "value": "{{content_sha256}}",
        "description": "(Required) Content sha256 for POST, PUT and PATCH operations",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "byoipRanges",
        ":byoipRangeId"
      ],
      "variable": [
        {
          "key": "byoipRangeId",
          "value": "amet ut",
          "description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource containing the BYOIP CIDR block."
        }
      ]
    },
    "description": "Updates the tags or display name associated to the specified BYOIP CIDR block.\n"
  },
  "response": [
    {
      "name": "The associated tags or display name for a BYOIP CIDR block were updated.",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "etag",
          "value": "officia sed",
          "description": "For optimistic concurrency control. See `if-match`.\n"
        },
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"id\": \"fugiat adipisicing quis anim commodo\",\n \"compartmentId\": \"tempor culpa mollit nisi\",\n \"cidrBlock\": \"laboredese\",\n \"lifecycleState\": \"UPDATING\",\n \"validationToken\": \"nisi\",\n \"timeCreated\": \"2002-03-26T06:43:06.961Z\",\n \"definedTags\": {},\n \"displayName\": \"Ut labore in nostrud\",\n \"freeformTags\": {},\n \"lifecycleDetails\": \"CREATING\",\n \"timeAdvertised\": \"1959-09-07T20:00:34.371Z\",\n \"timeValidated\": \"2018-04-14T04:07:30.549Z\",\n \"timeWithdrawn\": \"1961-12-25T13:30:04.079Z\"\n}"
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Not Found",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Precondition Failed",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Precondition Failed",
      "code": 412,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Internal Server Error",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "An error has occurred.",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Unique identifier for the request.\nIf you need to contact Oracle about a particular request, please provide the request ID.\n",
            "key": "opc-request-id",
            "value": "8wF"
          },
          {
            "description": "For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`\nparameter to the value of the etag from a previous GET or POST response for that resource. The resource\nwill be updated or deleted only if the etag you provide matches the resource's current etag value.\n",
            "key": "if-match",
            "value": "officia sed"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"definedTags\": {},\n    \"displayName\": \"tempor Excepteur minim culpa\",\n    \"freeformTags\": {}\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    }
  ]
}