Hi all, Recently I developed few CXF REST APIs to manage global and API specific mediation policies across APIs in APIM.To invoke those,Access token must be generated using correct scope for the resource. Summary of the work done is as of follows:
Retrieve all global mediation policies This operation provides you a list of available global mediation policies. If you want to get complete details of a mediation policy, you need to use *Get details of a mediation policy *operation. GET https://localhost:9443/api/am/admin/v0.10/apis/*policies/mediation* *Oauth 2.0 scope* : apim:mediation_policy_view *Request* : GET https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 *Response* : HTTP/1.1 200 OK Content-Type: application/json { "count":2, "next":null, "previous":null, "list":[ { "name":"json_fault", "id":"79768ea0-1dba-4611-95b9-e1e5b43ea984", "type":"fault" }, { "name":"json_to_xml_in_message", "id":"1813c3e8-d831-4e20-90e3-bbb70d2ca59e", "type":"in" } ] } Create a new global mediation policy This operation allows you to create a new mediation policy. POST https://localhost:9443/api/am/admin/v0.10/apis*/policies/mediation* *Oauth 2.0 scope* : apim:mediation_policy_create *Request* : POST https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 { "name":"json_fault", "type":"fault", "config":"<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"json_to_xml_in_message\"> <property name=\"messageType\" value= \"application/xml\" scope=\"axis2\"/></sequence>" } *Response* : HTTP/1.1 201 Created Location: https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation /0d59854f-01f1-404a-b668-e00292ed81e3 <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> Content-Type: application/json { "name":"json_fault", "id":"0d59854f-01f1-404a-b668-e00292ed81e3", "type":"fault", "config":"<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"json_to_xml_in_message\"> <property name=\"messageType\" value= \"application/xml\" scope=\"axis2\"/></sequence>" } Get details of a global mediation policy Using this operation, you can retrieve complete details of a single Mediation policy. You need to provide the uuid of the Mediation policy to retrieve it. GET https://localhost:9443/api/am/admin/v0.10/apis */policies/mediation/{uuid}* *Oauth 2.0 scope* : apim:mediation_policy_view *Request* : GET https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation /1813c3e8-d831-4e20-90e3-bbb70d2ca59e <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 *Response* : HTTP/1.1 200 OK Content-Type: application/json { "name":"json_to_xml_in_message", "id":"1813c3e8-d831-4e20-90e3-bbb70d2ca59e", "type":"in", "config":"<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"json_to_xml_in_message\"> <property name=\"messageType\" value= \"application/xml\" scope=\"axis2\"/></sequence>" } Update a existing global mediation policy This operation can be used to update an existing Mediation Policy by providing Mediation Policy uuid. PUT https://localhost:9443/api/am/admin/v0.10/apis */policies/mediation/{uuid}* *Oauth 2.0 scope* : apim:mediation_policy_create *Request* : PUT https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation /6fb74674-4ab8-4b52-9886-f9a376985060 <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/6fb74674-4ab8-4b52-9886-f9a376985060> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 { "name":"json_to_xml_in_message", "type":"in", "config":"<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"json_to_xml_in_message\"> <property name=\"messageType\" value= \"application/xml\" scope=\"axis2\"/></sequence>" } *Response* : HTTP/1.1 200 OK { "name":"json_to_xml_in_message", "id":"1813c3e8-d831-4e20-90e3-bbb70d2ca59e", "type":"in", "config":"<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"json_to_xml_in_message\"> <property name=\"messageType\" value= \"application/xml\" scope=\"axis2\"/></sequence>" } Delete a global mediation policy This operation can be used to delete an existing Mediation Policy by proving the uuid of the Mediation Policy DELETE https://localhost:9443/api/am/admin/v0.10/apis */policies/mediation/{uuid}* *Oauth 2.0 scope *: apim:mediation_policy_create *Request * : DELETE https://127.0.0.1:9443/api/am/admin/v0.10/policies/mediation /6fb74674-4ab8-4b52-9886-f9a376985060 <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/6fb74674-4ab8-4b52-9886-f9a376985060> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 *Response * : HTTP/1.1 200 OK Publisher REST APIs on upload/download the* API specific mediation policies* will accept the same payloads and the returning responses same as above unless the url of the endpoint directed to,https://127.0.0.1:9443/api/ am/publisher/v0.10/ *apis/{apiId}/policies/mediationAPI Specific Mediation Policies*Retrieve all API specific mediation policies of a API GET https://localhost:9443/api/am/publisher/v0.10/apis/ *{apiId}/policies/mediation* Oauth 2.0 scope : apim:api_view Request : GET https://127.0.0.1:9443/api/am/publisher/v0.10/apis/15382857- dbb2-4749-9c9c-4557c51048e2 <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation>/ policies/mediation <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Create a new API specific mediation policy POST https://localhost:9443/api/am/publisher/v0.10/apis/ *{apiId}/policies/mediation* Oauth 2.0 scope : apim:api_create Request : POST https://127.0.0.1:9443/api/am/publisher/v0.10/apis/15382857- dbb2-4749-9c9c-4557c51048e2 <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation>/po licies/mediation <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Get details of a API specific mediation policy GET https://localhost:9443/api/am/publisher/v0.10/apis/ *{apiId}/policies/mediation/{uuid}* Oauth 2.0 scope : apim:api_view Request : GET https://127.0.0.1:9443/api/am/publisher/v0.10/apis/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> 15382857-dbb2-4749-9c9c-4557c51048e2/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation>po licies/mediation/1813c3e8-d831-4e20-90e3-bbb70d2ca59e <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Update a existing API specific mediation policy PUT https://localhost:9443/api/am/publisher/v0.10/apis/ *{apiId}/policies/mediation/{uuid}**Oauth 2.0 scope* : apim:api_create *Request* : PUT https://127.0.0.1:9443/api/am/publisher/v0.10/apis/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> 15382857-dbb2-4749-9c9c-4557c51048e2/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation> policies/mediation/1813c3e8-d831-4e20-90e3-bbb70d2ca59e <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Delete a API specific mediation policy DELETE https://localhost:9443/api/am/publisher/v0.10/apis/ *{apiId}/policies/mediation/{uuid}**Oauth 2.0 scope *: apim:api_create *Request * : DELETE https://127.0.0.1:9443/api/am/publisher/v0.10/apis/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> 15382857-dbb2-4749-9c9c-4557c51048e2/ <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation>po licies/mediation/1813c3e8-d831-4e20-90e3-bbb70d2ca59e <https://127.0.0.1:9443/api/am/publisher/v0.10/policies/mediation/7a2298c4-c905-403f-8fac-38c73301631f> Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 If any modifications should be done on above, please reply. Regards, Kaveesha -- Kaveesha Perera Intern - Software Engineering mobile: 0716130471
_______________________________________________ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture