How to add additional properties for already create APIs. Sometimes in deployments we may need to change endpoint configurations and some other parameters after we created them.
For this we can go to management console, published and change them. But if you have large number of APIs that may be extremely hard. In this post lets see how we can do it for batch of API.
Please note that test this end to end before you push this change to production deployment. And also please note that some properties will be stored in registry, database and synapse configurations. So we need to change all 3 places. In this example we will consider endpoint configurations only(which available on registry and synapse).
Changing velocity template will work for new APIs. But when it comes to already published APIs, you have to do following process if you are not modifying it manually.
Write simple application to change synapse configuration and add new properties(as example we can consider timeout value).
Use a checkin/checkout client to edit the registry files with the new timeout value.
you can follow below mentioned steps to use the checkin/checkout client,
Download Governance Registry binary from http://wso2.com/products/governance-registry/ and extract the zip file.
Copy the content of Governance Registry in to APIM home.
Go into the bin directory of the Governance Registry directory.
Run the following command to checkout registry files to your local repository.
./checkin-client.sh co https://localhost:9443/registry/path -u admin -p admin (linux environment)
checkin-client.bat co https://localhost:9443/registry/path -u admin -p admin (windows environment)
Here the path is where your registry files are located. Normally API meta data will be listed under each provider '_system/governance/apimgt/applicationdata/provider'.
Once you run this command, registry files will be downloaded to your Governance Registry/bin directory. You can find the directories with user names who created the API.
Inside those directories there are files with same name 'api' in the location of '{directory with name of the api}/{directory with version of the api}/_system/governance
/apimgt/applicationdata/provider/{directory with name of the user}\directory with name of the api}/{directory with version of the api}' and you can edit the timeout value by
using a batch operation(shell script or any other way).
Then you have to checkin what you have changed by using the following command.
./checkin-client.sh ci https://localhost:9443/registry/path -u admin -p admin (linux)
checkin-client.bat ci https://localhost:9443/registry/path -u admin -p admin (windows)
Open APIM console and click on browse under resources. Provide the loaction as '/_system/governance/apimgt/applicationdata/provider'. Inside the {user name} directory
there are some directories with your API names. Open the 'api' files inside those directories and make sure the value has been updated.
Its recommend to change both registry and synapse configuration. This change will not be applicable to all properties available in API Manager.
This solution specifically designed for endpoint configurations such as time outs etc.
For this we can go to management console, published and change them. But if you have large number of APIs that may be extremely hard. In this post lets see how we can do it for batch of API.
Please note that test this end to end before you push this change to production deployment. And also please note that some properties will be stored in registry, database and synapse configurations. So we need to change all 3 places. In this example we will consider endpoint configurations only(which available on registry and synapse).
Changing velocity template will work for new APIs. But when it comes to already published APIs, you have to do following process if you are not modifying it manually.
Write simple application to change synapse configuration and add new properties(as example we can consider timeout value).
Use a checkin/checkout client to edit the registry files with the new timeout value.
you can follow below mentioned steps to use the checkin/checkout client,
Download Governance Registry binary from http://wso2.com/products/governance-registry/ and extract the zip file.
Copy the content of Governance Registry in to APIM home.
Go into the bin directory of the Governance Registry directory.
Run the following command to checkout registry files to your local repository.
./checkin-client.sh co https://localhost:9443/registry/path -u admin -p admin (linux environment)
checkin-client.bat co https://localhost:9443/registry/path -u admin -p admin (windows environment)
Here the path is where your registry files are located. Normally API meta data will be listed under each provider '_system/governance/apimgt/applicationdata/provider'.
Once you run this command, registry files will be downloaded to your Governance Registry/bin directory. You can find the directories with user names who created the API.
Inside those directories there are files with same name 'api' in the location of '{directory with name of the api}/{directory with version of the api}/_system/governance
/apimgt/applicationdata/provider/{directory with name of the user}\directory with name of the api}/{directory with version of the api}' and you can edit the timeout value by
using a batch operation(shell script or any other way).
Then you have to checkin what you have changed by using the following command.
./checkin-client.sh ci https://localhost:9443/registry/path -u admin -p admin (linux)
checkin-client.bat ci https://localhost:9443/registry/path -u admin -p admin (windows)
Open APIM console and click on browse under resources. Provide the loaction as '/_system/governance/apimgt/applicationdata/provider'. Inside the {user name} directory
there are some directories with your API names. Open the 'api' files inside those directories and make sure the value has been updated.
Its recommend to change both registry and synapse configuration. This change will not be applicable to all properties available in API Manager.
This solution specifically designed for endpoint configurations such as time outs etc.
No comments:
Post a Comment