Chilkat Online Tools

C++ / Core Services API / AdvertiseByoipRange

Back to Collection Items

#include <CkHttp.h>
#include <CkHttpResponse.h>

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

    CkHttp http;
    bool success;

    http.SetRequestHeader("opc-request-id","8wF");
    http.SetRequestHeader("x-content-sha256","{{content_sha256}}");
    http.SetRequestHeader("Authorization","{{signature}}");
    http.SetRequestHeader("Date","{{date}}");

    CkHttpResponse *resp = http.QuickRequest("POST","https://iaas.{{region}}.oraclecloud.com/20160918/byoipRanges/:byoipRangeId/actions/advertise");
    if (http.get_LastMethodSuccess() == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    int respStatusCode = resp->get_StatusCode();
    std::cout << "Response Status Code = " << respStatusCode << "\r\n";
    if (respStatusCode != 204) {
        std::cout << "Response Header:" << "\r\n";
        std::cout << resp->header() << "\r\n";
        std::cout << "Response Body:" << "\r\n";
        std::cout << resp->bodyStr() << "\r\n";
        std::cout << "Failed." << "\r\n";
        delete resp;
        return;
    }

    delete resp;
    std::cout << "Success." << "\r\n";
    }

Curl Command

curl -X POST
	-H "opc-request-id: 8wF"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
	-H "x-content-sha256: {{content_sha256}}"
https://iaas.{{region}}.oraclecloud.com/20160918/byoipRanges/:byoipRangeId/actions/advertise

Postman Collection Item JSON

{
  "name": "AdvertiseByoipRange",
  "request": {
    "method": "POST",
    "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"
      },
      {
        "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"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "byoipRanges",
        ":byoipRangeId",
        "actions",
        "advertise"
      ],
      "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": "Begins BGP route advertisements for the BYOIP CIDR block you imported to the Oracle Cloud.\nThe `ByoipRange` resource must be in the PROVISIONED state before the BYOIP CIDR block routes can be advertised with BGP.\n"
  },
  "response": [
    {
      "name": "The BYOIP CIDR block is being advertised.",
      "originalRequest": {
        "method": "POST",
        "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"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId",
            "actions",
            "advertise"
          ],
          "variable": [
            {
              "key": "byoipRangeId"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "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": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "POST",
        "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"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId",
            "actions",
            "advertise"
          ],
          "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": "POST",
        "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"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId",
            "actions",
            "advertise"
          ],
          "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": "Internal Server Error",
      "originalRequest": {
        "method": "POST",
        "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"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId",
            "actions",
            "advertise"
          ],
          "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": "POST",
        "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"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/byoipRanges/:byoipRangeId/actions/advertise",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "byoipRanges",
            ":byoipRangeId",
            "actions",
            "advertise"
          ],
          "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}"
    }
  ]
}