Chilkat Online Tools

DataFlex / Core Services API / GetVirtualCircuit

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sValue
    String sStrVal
    String sBandwidthShapeName
    String sBgpManagement
    String sBgpSessionState
    String sCompartmentId
    Integer iCustomerBgpAsn
    String sDisplayName
    String sGatewayId
    String sId
    String sLifecycleState
    Integer iOracleBgpAsn
    String sProviderName
    String sProviderServiceId
    String sProviderServiceKeyName
    String sProviderServiceName
    String sProviderState
    String sReferenceComment
    String sRegion
    String sServiceType
    String sTimeCreated
    String sV_type
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "Authorization" "{{signature}}"
    Send ComSetRequestHeader To hoHttp "Date" "{{date}}"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://iaas.{{region}}.oraclecloud.com/20160918/virtualCircuits/:virtualCircuitId" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    // {
    //   "bandwidthShapeName": "aliquip quis",
    //   "bgpManagement": "PROVIDER_MANAGED",
    //   "bgpSessionState": "UP",
    //   "compartmentId": "ex voluptate ea eiusmod",
    //   "crossConnectMappings": [
    //     {
    //       "value": "<Error: Too many levels of nesting to fake this schema>"
    //     },
    //     {
    //       "value": "<Error: Too many levels of nesting to fake this schema>"
    //     }
    //   ],
    //   "customerBgpAsn": 32592947,
    //   "definedTags": {},
    //   "displayName": "sunt exercitation",
    //   "freeformTags": {},
    //   "gatewayId": "sed deserunt magna",
    //   "id": "ex Duis amet culpa",
    //   "lifecycleState": "PROVISIONING",
    //   "oracleBgpAsn": 34318225,
    //   "providerName": "ullamco occaecat culpa cillum",
    //   "providerServiceId": "nisi ex culpa dolor",
    //   "providerServiceKeyName": "nostru",
    //   "providerServiceName": "laboris labore",
    //   "providerState": "ACTIVE",
    //   "publicPrefixes": [
    //     "proident et amet qui dolor",
    //     "tempor nostrud"
    //   ],
    //   "referenceComment": "laboris fugiat do",
    //   "region": "dolore sint ut non",
    //   "routingPolicy": [
    //     "MARKET_LEVEL",
    //     "GLOBAL"
    //   ],
    //   "serviceType": "LAYER2",
    //   "timeCreated": "2021-02-05T13:31:56.554Z",
    //   "type": "PUBLIC"
    // }

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

    Get ComStringOf Of hoJResp "bandwidthShapeName" To sBandwidthShapeName
    Get ComStringOf Of hoJResp "bgpManagement" To sBgpManagement
    Get ComStringOf Of hoJResp "bgpSessionState" To sBgpSessionState
    Get ComStringOf Of hoJResp "compartmentId" To sCompartmentId
    Get ComIntOf Of hoJResp "customerBgpAsn" To iCustomerBgpAsn
    Get ComStringOf Of hoJResp "displayName" To sDisplayName
    Get ComStringOf Of hoJResp "gatewayId" To sGatewayId
    Get ComStringOf Of hoJResp "id" To sId
    Get ComStringOf Of hoJResp "lifecycleState" To sLifecycleState
    Get ComIntOf Of hoJResp "oracleBgpAsn" To iOracleBgpAsn
    Get ComStringOf Of hoJResp "providerName" To sProviderName
    Get ComStringOf Of hoJResp "providerServiceId" To sProviderServiceId
    Get ComStringOf Of hoJResp "providerServiceKeyName" To sProviderServiceKeyName
    Get ComStringOf Of hoJResp "providerServiceName" To sProviderServiceName
    Get ComStringOf Of hoJResp "providerState" To sProviderState
    Get ComStringOf Of hoJResp "referenceComment" To sReferenceComment
    Get ComStringOf Of hoJResp "region" To sRegion
    Get ComStringOf Of hoJResp "serviceType" To sServiceType
    Get ComStringOf Of hoJResp "timeCreated" To sTimeCreated
    Get ComStringOf Of hoJResp "type" To sV_type
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "crossConnectMappings" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "crossConnectMappings[i].value" To sValue
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "publicPrefixes" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "publicPrefixes[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "routingPolicy" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "routingPolicy[i]" To sStrVal
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -X GET
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/virtualCircuits/:virtualCircuitId

Postman Collection Item JSON

{
  "name": "GetVirtualCircuit",
  "request": {
    "method": "GET",
    "header": [
      {
        "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}}/virtualCircuits/:virtualCircuitId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "virtualCircuits",
        ":virtualCircuitId"
      ],
      "variable": [
        {
          "key": "virtualCircuitId",
          "value": "amet ut",
          "description": "(Required) The [OCID](/Content/General/Concepts/identifiers.htm) of the virtual circuit."
        }
      ]
    },
    "description": "Gets the specified virtual circuit's information."
  },
  "response": [
    {
      "name": "The virtual circuit was retrieved.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/virtualCircuits/:virtualCircuitId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "virtualCircuits",
            ":virtualCircuitId"
          ],
          "variable": [
            {
              "key": "virtualCircuitId"
            }
          ]
        }
      },
      "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 \"bandwidthShapeName\": \"aliquip quis\",\n \"bgpManagement\": \"PROVIDER_MANAGED\",\n \"bgpSessionState\": \"UP\",\n \"compartmentId\": \"ex voluptate ea eiusmod\",\n \"crossConnectMappings\": [\n  {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  },\n  {\n   \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n  }\n ],\n \"customerBgpAsn\": 32592947,\n \"definedTags\": {},\n \"displayName\": \"sunt exercitation\",\n \"freeformTags\": {},\n \"gatewayId\": \"sed deserunt magna\",\n \"id\": \"ex Duis amet culpa\",\n \"lifecycleState\": \"PROVISIONING\",\n \"oracleBgpAsn\": 34318225,\n \"providerName\": \"ullamco occaecat culpa cillum\",\n \"providerServiceId\": \"nisi ex culpa dolor\",\n \"providerServiceKeyName\": \"nostru\",\n \"providerServiceName\": \"laboris labore\",\n \"providerState\": \"ACTIVE\",\n \"publicPrefixes\": [\n  \"proident et amet qui dolor\",\n  \"tempor nostrud\"\n ],\n \"referenceComment\": \"laboris fugiat do\",\n \"region\": \"dolore sint ut non\",\n \"routingPolicy\": [\n  \"MARKET_LEVEL\",\n  \"GLOBAL\"\n ],\n \"serviceType\": \"LAYER2\",\n \"timeCreated\": \"2021-02-05T13:31:56.554Z\",\n \"type\": \"PUBLIC\"\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/virtualCircuits/:virtualCircuitId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "virtualCircuits",
            ":virtualCircuitId"
          ],
          "variable": [
            {
              "key": "virtualCircuitId"
            }
          ]
        }
      },
      "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": [
        ],
        "url": {
          "raw": "{{baseUrl}}/virtualCircuits/:virtualCircuitId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "virtualCircuits",
            ":virtualCircuitId"
          ],
          "variable": [
            {
              "key": "virtualCircuitId"
            }
          ]
        }
      },
      "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": "Internal Server Error",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/virtualCircuits/:virtualCircuitId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "virtualCircuits",
            ":virtualCircuitId"
          ],
          "variable": [
            {
              "key": "virtualCircuitId"
            }
          ]
        }
      },
      "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": [
        ],
        "url": {
          "raw": "{{baseUrl}}/virtualCircuits/:virtualCircuitId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "virtualCircuits",
            ":virtualCircuitId"
          ],
          "variable": [
            {
              "key": "virtualCircuitId"
            }
          ]
        }
      },
      "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}"
    }
  ]
}