Chilkat Online Tools

Foxpro / Anypoint Platform APIs / Get asset version groups Instances by Id

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loResp

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

* Use this online tool to generate code from sample JSON: Generate Code to Create JSON

* The following JSON is sent in the request body.

* {
*   "name": "test42",
*   "endpointUri": "http://google.de",
*   "isPublic": false
* }

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("name","test42")
loJson.UpdateString("endpointUri","http://google.de")
loJson.UpdateBool("isPublic",0)

* Adds the "Authorization: Bearer {{token}}" header.
loHttp.AuthToken = "{{token}}"

loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)

loResp = loHttp.PTextSb("PATCH","https://domain.com/exchange/api/v2/assets/{{organization_id}}/{{app_Id}}/versionGroups/v1/instances/external/{{external_instance_id}}",loSbRequestBody,"utf-8","application/json",0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbRequestBody
    CANCEL
ENDIF

? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp

RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody

Curl Command

curl -X PATCH
	-H "Authorization: Bearer {{token}}"
	-d '{
    "name":"test42",
    "endpointUri":"http://google.de",
    "isPublic":false
}'
https://domain.com/exchange/api/v2/assets/{{organization_id}}/{{app_Id}}/versionGroups/v1/instances/external/{{external_instance_id}}

Postman Collection Item JSON

{
  "name": "Get asset version groups Instances by Id",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\r\n    \"name\":\"test42\",\r\n    \"endpointUri\":\"http://google.de\",\r\n    \"isPublic\":false\r\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{url}}/exchange/api/v2/assets/{{organization_id}}/{{app_Id}}/versionGroups/v1/instances/external/{{external_instance_id}}",
      "host": [
        "{{url}}"
      ],
      "path": [
        "exchange",
        "api",
        "v2",
        "assets",
        "{{organization_id}}",
        "{{app_Id}}",
        "versionGroups",
        "v1",
        "instances",
        "external",
        "{{external_instance_id}}"
      ]
    }
  },
  "response": [
  ]
}