Are there any tools that help to automate the export of an API proxy and then get it checked into Git ?
We would like to allow developers use the Cloud UI to perform their development then have them “check it in” when they are done by automating ( probably via maven ) running a command that would export, unzip and then commit their changes to GIT.
I see the maven plugin, but it doesn’t seem to have an export mojo.
This could be automated relatively easy with the combination of apigeetool in NPM, which provides the capability to export the API proxies,Apigee Grunt.js, and some small knowledge of Node.js. you can also achieve this with Maven along with Mojo’s, but JavaScript makes it easier.
To download or export an API proxy from Apigee Edge, you can use this:
## download the bundle zip for an api proxy
GET :mgmtserver/v1/o/deecee/apis/weather-quota/revisions/1?format=bundle
Authorization: :edge-auth
This works whether the API Proxy is deployed or not. The above assumes mgmtserver is replaced by the Admin API endpoint for your management server (in the Apigee Edge cloud, it is https://api.enterprise.apigee.com)). For example, using curl from the command line, you can do this:
…replacing all the UPPERCASE) things with the appropriate choices for you.
To inquire about APIs or their revisions, use these:
## inquire api proxies in an organization
GET :mgmtserver/v1/o/ORGANIZATION/apis
Authorization: :edge-auth
## inquire revisions of a named api proxy
GET :mgmtserver/v1/o/ORGANIZATION/apis/API_PROXY_NAME/revisions
Authorization: :edge-auth
You can put the curl command directly into a parameterized bash script. If you don’t want to do the export using bash+curl, you can use any alternative scripting tool or language.
I will leave the “unzip and commit to git” as an exercise for you.
I created a bash script once to download all proxies from an org for automated backup, but it didn’t push to GitHub. Its pretty rudimentary, certainly not as cool as Grunt or Maven.
@Gregory_Bonk@Diego Zuluaga@Dino OK, so I went ahead and used some old school bash scripting to automate the download of a proxy, unzip and push to Github. Its not rocket science but it works for individual proxies. It supports “silent” or single button mode for a single proxy.
I’ll update to prompt for a proxy from the list if not provided and to do an all proxies mode.
@Mukundha Madhavan I tried using the script. However, I noticed that the script executes successfully and creates the “data” folder. But the downloaded API proxies are all empty zip files.