Chilkat Online Tools

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

Back to Collection Items

import sys
import chilkat2

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

http = chilkat2.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
# }

json = chilkat2.JsonObject()
json.UpdateString("name","test42")
json.UpdateString("endpointUri","http://google.de")
json.UpdateBool("isPublic",False)

# Adds the "Authorization: Bearer {{token}}" header.
http.AuthToken = "{{token}}"

sbRequestBody = chilkat2.StringBuilder()
json.EmitSb(sbRequestBody)

# resp is a CkHttpResponse
resp = http.PTextSb("PATCH","https://domain.com/exchange/api/v2/assets/{{organization_id}}/{{app_Id}}/versionGroups/v1/instances/external/{{external_instance_id}}",sbRequestBody,"utf-8","application/json",False,False)
if (http.LastMethodSuccess == False):
    print(http.LastErrorText)
    sys.exit()

print(str(resp.StatusCode))
print(resp.BodyStr)

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": [
  ]
}