PowerBuilder / Core Services API / AddImageShapeCompatibilityEntry
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_ImageId
string ls_Shape
string ls_Value
string ls_MinInGBsValue
string ls_MaxValue
string ls_MinValue
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "memoryConstraints": {
// "maxInGBs": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "minInGBs": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "ocpuConstraints": {
// "max": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "min": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("memoryConstraints.maxInGBs.value","<Error: Too many levels of nesting to fake this schema>")
loo_Json.UpdateString("memoryConstraints.minInGBs.value","<Error: Too many levels of nesting to fake this schema>")
loo_Json.UpdateString("ocpuConstraints.max.value","<Error: Too many levels of nesting to fake this schema>")
loo_Json.UpdateString("ocpuConstraints.min.value","<Error: Too many levels of nesting to fake this schema>")
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_Http.SetRequestHeader("x-content-sha256","{{content_sha256}}")
loo_Http.SetRequestHeader("Authorization","{{signature}}")
loo_Http.SetRequestHeader("Date","{{date}}")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("PUT","https://iaas.{{region}}.oraclecloud.com/20160918/images/:imageId/shapes/:shapeName",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.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_Json
destroy loo_SbRequestBody
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)
// {
// "imageId": "Duis ex elit",
// "shape": "nulla mollit",
// "memoryConstraints": {
// "maxInGBs": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "minInGBs": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "ocpuConstraints": {
// "max": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "min": {
// "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_ImageId = loo_JResp.StringOf("imageId")
ls_Shape = loo_JResp.StringOf("shape")
ls_Value = loo_JResp.StringOf("memoryConstraints.maxInGBs.value")
ls_MinInGBsValue = loo_JResp.StringOf("memoryConstraints.minInGBs.value")
ls_MaxValue = loo_JResp.StringOf("ocpuConstraints.max.value")
ls_MinValue = loo_JResp.StringOf("ocpuConstraints.min.value")
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
-H "x-content-sha256: {{content_sha256}}"
-d '{
"memoryConstraints": {
"maxInGBs": {
"value": "<Error: Too many levels of nesting to fake this schema>"
},
"minInGBs": {
"value": "<Error: Too many levels of nesting to fake this schema>"
}
},
"ocpuConstraints": {
"max": {
"value": "<Error: Too many levels of nesting to fake this schema>"
},
"min": {
"value": "<Error: Too many levels of nesting to fake this schema>"
}
}
}'
https://iaas.{{region}}.oraclecloud.com/20160918/images/:imageId/shapes/:shapeName
Postman Collection Item JSON
{
"name": "AddImageShapeCompatibilityEntry",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"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"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId",
"value": "officia sed",
"description": "(Required) The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the image."
},
{
"key": "shapeName",
"value": "amet ut",
"description": "(Required) Shape name."
}
]
},
"description": "Adds a shape to the compatible shapes list for the image."
},
"response": [
{
"name": "The shape has been added to the compatible shapes list.",
"originalRequest": {
"method": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"status": "OK",
"code": 200,
"_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 \"imageId\": \"Duis ex elit\",\n \"shape\": \"nulla mollit\",\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"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": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"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": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"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": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"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": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"memoryConstraints\": {\n \"maxInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"minInGBs\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"ocpuConstraints\": {\n \"max\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"min\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/images/:imageId/shapes/:shapeName",
"host": [
"{{baseUrl}}"
],
"path": [
"images",
":imageId",
"shapes",
":shapeName"
],
"variable": [
{
"key": "imageId"
},
{
"key": "shapeName"
}
]
}
},
"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}"
}
]
}