Hi
I have a requirement where I want to attach a Javascript Policy to all the API Proxys with out any manual intervention. I have Apigee instances on cloud ( GCP) as well as on prem apigee instances. I am wondering how I can connect to those instances from a Unix shell / python script and attach the Javascript Policies to all APIs that are published.
I am confused with the APIs listed at https://cloud.google.com/apigee/docs/reference/apis/apigee/rest and those at https://apidocs.apigee.com/.
I tried the API at https://apidocs.apigee.com/docs/policies/1/routes/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/r... to get the list of policies published on my GCP hosted apigee (https://apigee.google.com/organizations/apigee-358813/proxies) using my username and password however I am getting below error
Note: Basic auth always returns 401 for user accounts that have MFA enabled.
https://docs.apigee.com/api-platform/system-administration/basic-auth
Or maybe you just mistyped your password.
To validate your password, login to the UI at https://login.apigee.com
If necessary, reset your password at https://login.apigee.com/reset
I am able to use the Api https://apigee.googleapis.com/v1/organizations/$ORG/apis using OAuth.
Any help is greatly appreciated.
Solved! Go to Solution.
I am confused with the APIs listed at https://cloud.google.com/apigee/docs/reference/apis/apigee/rest and those at https://apidocs.apigee.com/.
Hmm, yes. Well there is the Apigee Edge documentation, pertaining to the Apigee hosted at apigee.com. This also applies to OPDK. The REST APIs for Edge and OPDK is available at https://apidocs.apigee.com
In 2019 we launched Apigee hybrid, and in 2020, Apigee X. The REST APIs for these are very similar but not exactly the same as those APIs for Edge. These APIs are documented at https://cloud.google.com/apigee/docs/reference/apis/apigee/rest .
If you are using Apigee X or hybrid, use the docs anchored at google.com. If you are using Edge or OPDK, use the docs anchored at apigee.com .
I tried the API at https://apidocs.apigee.com/docs/policies/1/routes/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/r...to get the list of policies published on my GCP hosted apigee (https://apigee.google.com/organizations/apigee-358813/proxies)
You can't do that. The APIs documented at apidocs.apigee.com will not work against things managed under apigee.google.com . The API endpoint you must use for APIs hosted under apigee.google.com is apigee.googleapis.com
Also, there is no API, as far as I know, under apigee.googleapis.com, to list "all the policies in an API proxy". Instead what you must do is EXPORT the API proxy, unzip the resulting zip file, and examine the unzipped bundle.
There is a tool that does this: listProxyPolicies.js
As far as UPDATING each proxy ... again there is no API that allows you to add a policy to an existing API proxy, in apigee.googleapis.com . If you want to add a policy to each proxy, you would have to
I am confused with the APIs listed at https://cloud.google.com/apigee/docs/reference/apis/apigee/rest and those at https://apidocs.apigee.com/.
Hmm, yes. Well there is the Apigee Edge documentation, pertaining to the Apigee hosted at apigee.com. This also applies to OPDK. The REST APIs for Edge and OPDK is available at https://apidocs.apigee.com
In 2019 we launched Apigee hybrid, and in 2020, Apigee X. The REST APIs for these are very similar but not exactly the same as those APIs for Edge. These APIs are documented at https://cloud.google.com/apigee/docs/reference/apis/apigee/rest .
If you are using Apigee X or hybrid, use the docs anchored at google.com. If you are using Edge or OPDK, use the docs anchored at apigee.com .
I tried the API at https://apidocs.apigee.com/docs/policies/1/routes/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/r...to get the list of policies published on my GCP hosted apigee (https://apigee.google.com/organizations/apigee-358813/proxies)
You can't do that. The APIs documented at apidocs.apigee.com will not work against things managed under apigee.google.com . The API endpoint you must use for APIs hosted under apigee.google.com is apigee.googleapis.com
Also, there is no API, as far as I know, under apigee.googleapis.com, to list "all the policies in an API proxy". Instead what you must do is EXPORT the API proxy, unzip the resulting zip file, and examine the unzipped bundle.
There is a tool that does this: listProxyPolicies.js
As far as UPDATING each proxy ... again there is no API that allows you to add a policy to an existing API proxy, in apigee.googleapis.com . If you want to add a policy to each proxy, you would have to