Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Apigee X and KVM: weird API behaviour

Hello

I was working on KVM via the Apigee X API, following instructions from the Github repo of @lalevee (https://github.com/g-lalevee/Apigee-X-GCP-Logging), and I noticed an issue related to environment (I guess it's a typo in the repo, but...)

Let me explain with a succession of curl calls:

$ AUTH=$(gcloud auth print-access-token)

$ # List existing ENV
$ curl -XGET -H "Authorization: Bearer $AUTH" \
https://apigee.googleapis.com/v1/organizations/myOrg/environments
[
  "env1",
  "env2"
]

$ # CREATE a KVM, BUT by indicating an exoting ENVIRONMENT
$ curl -X POST \
-H "Content-Type: aplication/json" \
-H "Authorization: Bearer $AUTH" \
https://apigee.googleapis.com/v1/organizations/myOrg/environments/arnaduga/keyvaluemaps \
-d '{"name":"TestArnaduga","encrypted":true}'
{
  "name": "TestArnaduga",
  "encrypted": true
}

$ # List KVM of an inexistant env
$ curl -X GET \
-H "Authorization: Bearer $AUTH" \
https://apigee.googleapis.com/v1/organizations/myOrg/environments/arnaduga/keyvaluemaps
[
  "TestArnaduga"
]

$ # Inserting key
$ curl -X POST \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json" \
https://apigee.googleapis.com/v1/organizations/myOrg/environments/arnaduga/keyvaluemaps/TestArnaduga/entries \
-d '{"name":"testKey","value":"testValue"}'
{
  "name": "testKey",
  "value": "testValue"
}

$ # Listing keys
$ curl -X GET \
-H "Authorization: Bearer $AUTH" \
https://apigee.googleapis.com/v1/organizations/myOrg/environments/arnaduga/keyvaluemaps/TestArnaduga/entries
{
  "keyValueEntries": [
    {
      "name": "testKey",
      "value": "testValue"
    }
  ],
  "nextPageToken": ""
}

$

 

TL;DR
Is it a normal situation to be able to create KVM and Keys on a environments that does not exist?

Arnaduga

0 2 198
2 REPLIES 2
Top Solution Authors