Hi,
I'm getting the wrong results using Apigee's API for KVM.
When I try to get a lists keys in a key value map from an org, I receive a KVM that is not listed in my org.
My org has the following KVMs (dev/hml/prd):
With the API I get this kvm called "privacy":
And I can access the contents from this "privacy" kvm:
I also tested with a terminal and got the same results.
How can I access the correct KVMs with API, please?
Thanks in advance.
P.S.: I tested some other API functions with the same user and got correct values from my org.
Solved! Go to Solution.
Correct (mostly). In Apigee Edge, KVMs have a scope, one of organization, environment, or proxy.
The UI snap you showed, queries the environment-scoped KVMs.
The API you tried, queries the organization-scoped KVMs. That's why you see different results. If you want to use the API to retrieve environment-scoped KVMs that you need to use the URL
https://api.enterprise.apigee.com/v1/o/:ORG/e/:ENV/keyvaluemaps
The reason I say the above answer is "mostly" correct: The URL offered there is for Apigee X, not Apigee Edge. Apigee X does not have organization-scoped KVMs, nor proxy-scoped KVMs. So the response above is correct, in that you need to add the environments/ENV segments to the URL path. But not correct in the basic endpoint. apigee.googleapis.com applies only to Apigee X and hybrid. api.enterprise.apigee.com works for Apigee Edge.
Hey. I think you have to include the name of the environment too. In your case, we don't know the organization name and the environment is dev so try:
https://apigee.googleapis.com/v1/organizations/<your_org>/environments/dev/keyvaluemaps
Here is the link to the documentation:
https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.keyval...
Correct (mostly). In Apigee Edge, KVMs have a scope, one of organization, environment, or proxy.
The UI snap you showed, queries the environment-scoped KVMs.
The API you tried, queries the organization-scoped KVMs. That's why you see different results. If you want to use the API to retrieve environment-scoped KVMs that you need to use the URL
https://api.enterprise.apigee.com/v1/o/:ORG/e/:ENV/keyvaluemaps
The reason I say the above answer is "mostly" correct: The URL offered there is for Apigee X, not Apigee Edge. Apigee X does not have organization-scoped KVMs, nor proxy-scoped KVMs. So the response above is correct, in that you need to add the environments/ENV segments to the URL path. But not correct in the basic endpoint. apigee.googleapis.com applies only to Apigee X and hybrid. api.enterprise.apigee.com works for Apigee Edge.