Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
CkHttp::ckSetRequestHeader(http,"Authorization","{{signature}}")
CkHttp::ckSetRequestHeader(http,"Date","{{date}}")
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckQuickGetSb(http,"https://iaas.{{region}}.oraclecloud.com/20160918/images/:imageId",sbResponseBody)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,sbResponseBody)
CkJsonObject::setCkEmitCompact(jResp, 0)
Debug "Response Body:"
Debug CkJsonObject::ckEmit(jResp)
respStatusCode.i = CkHttp::ckLastStatus(http)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode >= 400
Debug "Response Header:"
Debug CkHttp::ckLastHeader(http)
Debug "Failed."
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "compartmentId": "dolor commodo in",
; "id": "eu dolor Duis dolore irure",
; "lifecycleState": "AVAILABLE",
; "timeCreated": "1985-05-13T06:46:51.335Z",
; "operatingSystem": "deserunt cillum elit",
; "operatingSystemVersion": "sint et mollit do",
; "createImageAllowed": true,
; "agentFeatures": {
; "isManagementSupported": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "isMonitoringSupported": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; }
; },
; "baseImageId": "cillum exercitation voluptate non ullamco",
; "billableSizeInGBs": 16490567,
; "definedTags": {},
; "displayName": "qui laborum ad",
; "freeformTags": {},
; "launchMode": "PARAVIRTUALIZED",
; "launchOptions": {
; "bootVolumeType": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "firmware": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "isConsistentVolumeNamingEnabled": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "isPvEncryptionInTransitEnabled": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "networkType": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; },
; "remoteDataVolumeType": {
; "value": "<Error: Too many levels of nesting to fake this schema>"
; }
; },
; "sizeInMBs": 57090852
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
compartmentId.s = CkJsonObject::ckStringOf(jResp,"compartmentId")
id.s = CkJsonObject::ckStringOf(jResp,"id")
lifecycleState.s = CkJsonObject::ckStringOf(jResp,"lifecycleState")
timeCreated.s = CkJsonObject::ckStringOf(jResp,"timeCreated")
operatingSystem.s = CkJsonObject::ckStringOf(jResp,"operatingSystem")
operatingSystemVersion.s = CkJsonObject::ckStringOf(jResp,"operatingSystemVersion")
createImageAllowed.i = CkJsonObject::ckBoolOf(jResp,"createImageAllowed")
Value.s = CkJsonObject::ckStringOf(jResp,"agentFeatures.isManagementSupported.value")
IsMonitoringSupportedValue.s = CkJsonObject::ckStringOf(jResp,"agentFeatures.isMonitoringSupported.value")
baseImageId.s = CkJsonObject::ckStringOf(jResp,"baseImageId")
billableSizeInGBs.i = CkJsonObject::ckIntOf(jResp,"billableSizeInGBs")
displayName.s = CkJsonObject::ckStringOf(jResp,"displayName")
launchMode.s = CkJsonObject::ckStringOf(jResp,"launchMode")
BootVolumeTypeValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.bootVolumeType.value")
FirmwareValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.firmware.value")
IsConsistentVolumeNamingEnabledValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.isConsistentVolumeNamingEnabled.value")
IsPvEncryptionInTransitEnabledValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.isPvEncryptionInTransitEnabled.value")
NetworkTypeValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.networkType.value")
RemoteDataVolumeTypeValue.s = CkJsonObject::ckStringOf(jResp,"launchOptions.remoteDataVolumeType.value")
sizeInMBs.i = CkJsonObject::ckIntOf(jResp,"sizeInMBs")
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure
Curl Command
curl -X GET
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
https://iaas.{{region}}.oraclecloud.com/20160918/images/:imageId
Postman Collection Item JSON
{
"name": "GetImage",
"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}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId",
"value": "officia sed",
"description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the image."
}
]
},
"description": "Gets the specified image."
},
"response": [
{
"name": "The image was retrieved.",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId"
}
]
}
},
"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 \"compartmentId\": \"dolor commodo in\",\n \"id\": \"eu dolor Duis dolore irure\",\n \"lifecycleState\": \"AVAILABLE\",\n \"timeCreated\": \"1985-05-13T06:46:51.335Z\",\n \"operatingSystem\": \"deserunt cillum elit\",\n \"operatingSystemVersion\": \"sint et mollit do\",\n \"createImageAllowed\": true,\n \"agentFeatures\": {\n \"isManagementSupported\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"isMonitoringSupported\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"baseImageId\": \"cillum exercitation voluptate non ullamco\",\n \"billableSizeInGBs\": 16490567,\n \"definedTags\": {},\n \"displayName\": \"qui laborum ad\",\n \"freeformTags\": {},\n \"launchMode\": \"PARAVIRTUALIZED\",\n \"launchOptions\": {\n \"bootVolumeType\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"firmware\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"isConsistentVolumeNamingEnabled\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"isPvEncryptionInTransitEnabled\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"networkType\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"remoteDataVolumeType\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"sizeInMBs\": 57090852\n}"
},
{
"name": "Unauthorized",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId"
}
]
}
},
"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}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId"
}
]
}
},
"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}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId"
}
]
}
},
"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}}/images/:imageId",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId"
],
"variable": [
{
"key": "imageId"
}
]
}
},
"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}"
}
]
}