How can we add a policy to an existing Proxy through rest api call in APIGEE X?

I want to add a policy to an existing proxy, and I don't want to use UI for it, I want to add the polcy through a rest API call. Can we do this in APIGEE X?

0 1 75
1 REPLY 1

No, there is no granular API to add the policy through a rest API call. 

Yes, you can achieve what you want by using your preferred scripting/programming language. You script the steps to:

1. Download a proxy you want to amend

2. Unzip the downloaded proxy, add a policy in question, edit proxy xml to 'hook' it in the right place. Then zip the result.

3. Upload and deploy the proxy.

You use tools like apigeecli or sackmesser or maven plugin to execute steps 1 and 3 as a high-level coarse-grained operations that wrap rest calls to management API. You can use management API directly for download/upload proxy though, if you wish.

https://github.com/apigee/apigeecli

https://github.com/apigee/devrel/tree/main/tools/apigee-sackmesser

https://github.com/apigee/apigee-deploy-maven-plugin