Chilkat Online Tools

C++ / Core Services API / DeleteDedicatedVmHost

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("Authorization","{{signature}}");
    http.SetRequestHeader("Date","{{date}}");

    CkHttpResponse *resp = http.QuickRequest("DELETE","https://iaas.{{region}}.oraclecloud.com/20160918/dedicatedVmHosts/:dedicatedVmHostId");
    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 DELETE
	-H "opc-request-id: 8wF"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/dedicatedVmHosts/:dedicatedVmHostId

Postman Collection Item JSON

{
  "name": "DeleteDedicatedVmHost",
  "request": {
    "method": "DELETE",
    "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"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/dedicatedVmHosts/:dedicatedVmHostId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "dedicatedVmHosts",
        ":dedicatedVmHostId"
      ],
      "variable": [
        {
          "key": "dedicatedVmHostId",
          "value": "officia sed",
          "description": "(Required) The OCID of the dedicated VM host."
        }
      ]
    },
    "description": "Deletes the specified dedicated virtual machine host.\n\nIf any VM instances are assigned to the dedicated virtual machine host,\nthe delete operation will fail and the service will return a 409 response code.\n"
  },
  "response": [
    {
      "name": "The dedicated virtual machine host is being deleted.",
      "originalRequest": {
        "method": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "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": "opc-work-request-id",
          "value": "officia sed",
          "description": "The [OCID](/Content/General/Concepts/identifiers.htm) of the work request. Use [GetWorkRequest](/api/#/en/workrequests/20160918/WorkRequest/GetWorkRequest)\nwith this ID to track the status of the request.\n"
        },
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "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": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "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": "Conflict",
      "originalRequest": {
        "method": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "status": "Conflict",
      "code": 409,
      "_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": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "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": "DELETE",
        "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}}/dedicatedVmHosts/:dedicatedVmHostId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "dedicatedVmHosts",
            ":dedicatedVmHostId"
          ],
          "variable": [
            {
              "key": "dedicatedVmHostId"
            }
          ]
        }
      },
      "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}"
    }
  ]
}