Oracle Integration Cloud provides rich set of REST APIs to manage your connections/integration and life-cycle events. See details here for complete set.
There the APIs to get list of integration in JSON format but at this point there is no out of box API support for filtering out the results by creator or author of the artifact. One can use common programming language to parse the filter out the results but that require additional effort.
In this blog, I will provide simple command line means of achieving that. We will use curl and one command line library to parse JSON data - https://stedolan.github.io/jq/
The following was developed and tested on Mac OS (Mojave 10.14.6 ) and OIC version 19.3.1.0.0 (190624.1100.29533)
Install jq
brew install jq
Get list of integrations
Replace the highlighted (in blue) for your environment...
curl -u username@email.com:password -H "Content-Type:application/json" -H "Accept:application/json" -X GET https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations | jq '. | {code: [.items[].code]}'
To filter out integrations for a given user
Replace the author@email.com in command below with the user you would like to filter the results...
curl -u username@email.com:password -H "Content-Type:application/json" -H "Accept:application/json" -X GET https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations | jq '. | {integrations: .items[].code, createdBy : .items[].createdBy} | select(.createdBy == "author@email.com")'
There the APIs to get list of integration in JSON format but at this point there is no out of box API support for filtering out the results by creator or author of the artifact. One can use common programming language to parse the filter out the results but that require additional effort.
In this blog, I will provide simple command line means of achieving that. We will use curl and one command line library to parse JSON data - https://stedolan.github.io/jq/
The following was developed and tested on Mac OS (Mojave 10.14.6 ) and OIC version 19.3.1.0.0 (190624.1100.29533)
Install jq
brew install jq
Get list of integrations
Replace the highlighted (in blue) for your environment...
curl -u username@email.com:password -H "Content-Type:application/json" -H "Accept:application/json" -X GET https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations | jq '. | {code: [.items[].code]}'
To filter out integrations for a given user
Replace the author@email.com in command below with the user you would like to filter the results...
curl -u username@email.com:password -H "Content-Type:application/json" -H "Accept:application/json" -X GET https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations | jq '. | {integrations: .items[].code, createdBy : .items[].createdBy} | select(.createdBy == "author@email.com")'
You can use similar command to filter other artifacts such as connections etc.
No comments:
Post a Comment