Api Monitoring - Management Api for Collection Update?

Hey all,

Getting an error when attempting to update a proxy collection for api monitoring via postman. I can GET list of collections by org, then GET specific collection based on UUID (https://apimonitoring.enterprise.apigee.com/collections/uuid)

I'm getting an error when trying to modify (PUT) the collection (add proxy to existing). I'm thinking maybe I'm not sending the request correctly? Couldn't find any api details in the documentation so it's mostly me doing trial/error. What is the correct api for updating collection? When i do a PUT on https://apimonitoring.enterprise.apigee.com/collections/<uuid>; I get the following error:

{ "fault": { "faultstring": "Received 405 Response without Allow Header", "detail": { "errorcode": "protocol.http.Response405WithoutAllowHeader" } }

Appreciate any help,

Thanks!

Solved Solved
0 2 373
1 ACCEPTED SOLUTION

Hi @wesley.scott5,

There are a couple of things to bear in mind when updating collections via the API.

1. The HTTP Method is PATCH since you are updating a sub-set of the resource.

2. The request body must contain a JSON payload. Thus the following header must be set:

Content-Type: application/json

3. The request body can be copied from the result from the GET request, with the uuid, updatedAt, and updatedBy fields removed. For example if the response is:

[
  {
    "uuid": "9006396a-f05d-4cc4-af67-dddf313d3a49",
    "organization": "myorg",
    "environment": "prod",
    "name": "mycollection",
    "type": "proxy",
    "members": [
      "apigee-healthcheck",
      "apigee-apiproxy",
      "edgemicro-auth"
    ],
    "description": "testing",
    "updatedAt": "2019-01-07T04:50:58Z",
    "updatedBy": "markeccles@google.com"
  }
]

Then the request body could be: (to remove apigee-apiproxy from the collection)

{
    "organization": "myorg",
    "environment": "prod",
    "name": "mycollection",
    "type": "proxy",
    "members": [
      "apigee-healthcheck",
      "edgemicro-auth"
    ],
    "description": "testing"
}

Note we are patching a single collection resource, so the square brackets are removed.

Hope this helps!

View solution in original post

2 REPLIES 2

Hi @wesley.scott5,

There are a couple of things to bear in mind when updating collections via the API.

1. The HTTP Method is PATCH since you are updating a sub-set of the resource.

2. The request body must contain a JSON payload. Thus the following header must be set:

Content-Type: application/json

3. The request body can be copied from the result from the GET request, with the uuid, updatedAt, and updatedBy fields removed. For example if the response is:

[
  {
    "uuid": "9006396a-f05d-4cc4-af67-dddf313d3a49",
    "organization": "myorg",
    "environment": "prod",
    "name": "mycollection",
    "type": "proxy",
    "members": [
      "apigee-healthcheck",
      "apigee-apiproxy",
      "edgemicro-auth"
    ],
    "description": "testing",
    "updatedAt": "2019-01-07T04:50:58Z",
    "updatedBy": "markeccles@google.com"
  }
]

Then the request body could be: (to remove apigee-apiproxy from the collection)

{
    "organization": "myorg",
    "environment": "prod",
    "name": "mycollection",
    "type": "proxy",
    "members": [
      "apigee-healthcheck",
      "edgemicro-auth"
    ],
    "description": "testing"
}

Note we are patching a single collection resource, so the square brackets are removed.

Hope this helps!

@Mark Eccles Brilliant! Exactly what I was looking for, thank you!