Chilkat Online Tools

PowerBuilder / Core Services API / Get a Virtual Networking topology for the current region

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Value
string ls_EntitiesValue
string ls_RelationshipsValue
string ls_TimeCreatedValue

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_QueryParams.UpdateString("compartmentId","{{compartment_ocid}}")
loo_QueryParams.UpdateString("accessLevel","ANY")
loo_QueryParams.UpdateString("queryCompartmentSubtree","true")

loo_Http.SetRequestHeader("opc-request-id","8wF")
loo_Http.SetRequestHeader("Date","{{date}}")
loo_Http.SetRequestHeader("Authorization","{{signature}}")
loo_Http.SetRequestHeader("cache-control","officia sed")
loo_Http.SetRequestHeader("if-none-match","officia sed")

loo_Resp = loo_Http.QuickRequestParams("GET","https://iaas.{{region}}.oraclecloud.com/20160918/networkingTopology",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_QueryParams
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

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

// {
//   "type": {
//     "value": "<Error: Too many levels of nesting to fake this schema>"
//   },
//   "entities": {
//     "value": "<Error: Too many levels of nesting to fake this schema>"
//   },
//   "relationships": {
//     "value": "<Error: Too many levels of nesting to fake this schema>"
//   },
//   "timeCreated": {
//     "value": "<Error: Too many levels of nesting to fake this schema>"
//   }
// }

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

ls_Value = loo_JResp.StringOf("type.value")
ls_EntitiesValue = loo_JResp.StringOf("entities.value")
ls_RelationshipsValue = loo_JResp.StringOf("relationships.value")
ls_TimeCreatedValue = loo_JResp.StringOf("timeCreated.value")


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -G -d "compartmentId=%7B%7Bcompartment_ocid%7D%7D"
	-d "accessLevel=ANY"
	-d "queryCompartmentSubtree=true"
	-H "opc-request-id: 8wF"
	-H "if-none-match: officia sed"
	-H "cache-control: officia sed"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/networkingTopology

Postman Collection Item JSON

{
  "name": "Get a Virtual Networking topology for the current region",
  "request": {
    "method": "GET",
    "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
        "key": "if-none-match",
        "value": "officia sed"
      },
      {
        "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
        "key": "cache-control",
        "value": "officia sed"
      },
      {
        "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}}/networkingTopology?compartmentId={{compartment_ocid}}&accessLevel=ANY&queryCompartmentSubtree=true",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "networkingTopology"
      ],
      "query": [
        {
          "key": "compartmentId",
          "value": "{{compartment_ocid}}",
          "description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment."
        },
        {
          "key": "accessLevel",
          "value": "ANY",
          "description": "Valid values are `ANY` and `ACCESSIBLE`. The default is `ANY`.\nSetting this to `ACCESSIBLE` returns only compartments for which a\nuser has INSPECT permissions, either directly or indirectly (permissions can be on a\nresource in a subcompartment). A restricted set of fields is returned for compartments in which a user has\nindirect INSPECT permissions.\n\nWhen set to `ANY` permissions are not checked.\n"
        },
        {
          "key": "queryCompartmentSubtree",
          "value": "true",
          "description": "When set to true, the hierarchy of compartments is traversed\nand the specified compartment and its subcompartments are\ninspected depending on the the setting of `accessLevel`.\nDefault is false.\n"
        }
      ]
    },
    "description": "Gets a virtual networking topology for the current region."
  },
  "response": [
    {
      "name": "The topology was successfully returned.",
      "originalRequest": {
        "method": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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 \"type\": {\n  \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"entities\": {\n  \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"relationships\": {\n  \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"timeCreated\": {\n  \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n}"
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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": "Too many requests",
      "originalRequest": {
        "method": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_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": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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": "GET",
        "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 querying if there is a cached value on the server. The If-None-Match HTTP request header \nmakes the request conditional. For GET and HEAD methods, the server will send back the requested \nresource, with a 200 status, only if it doesn't have an ETag matching the given ones. \nFor other methods, the request will be processed only if the eventually existing resource's \nETag doesn't match any of the values listed.\n",
            "key": "if-none-match",
            "value": "officia sed"
          },
          {
            "description": "The Cache-Control HTTP header holds directives (instructions)\nfor caching in both requests and responses.\n",
            "key": "cache-control",
            "value": "officia sed"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/networkingTopology?compartmentId=amet ut&accessLevel=ACCESSIBLE&queryCompartmentSubtree=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "networkingTopology"
          ],
          "query": [
            {
              "key": "compartmentId",
              "value": "amet ut"
            },
            {
              "key": "accessLevel",
              "value": "ACCESSIBLE"
            },
            {
              "key": "queryCompartmentSubtree",
              "value": "true"
            }
          ]
        }
      },
      "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}"
    }
  ]
}