Mediation Policy (Collection)


Get all global mediation policies

GET https://apis.wso2.com/api/am/admin/v0.15/policies/mediation

This operation provides you a list of available all global level mediation policies.

OAuth 2.0 Scope

apim:mediation_policy_viewi

Request

GET https://localhost:9443/api/am/admin/v0.15/policies/mediation Authorization: Bearer 36a1644d-16c8-3f10-af2a-cedac82a6f21

Response

HTTP/1.1 200 OK Content-Type: application/json { "count": 13, "next": null, "previous": null, "list": [ { "name": "debug_json_fault", "id": "563de8f3-dd1d-4ec7-afc2-d158c663ed34", "type": "fault" }, { "name": "json_fault", "id": "f9c36f4d-a2b6-41e7-b311-d358a47916be", "type": "fault" }, { "name": "debug_json_fault2", "id": "378169d3-6fd2-427f-b0db-0f378e89ccea", "type": "fault" }, { "name": "json_to_xml_in_message", "id": "3921225b-7918-4b95-a851-22c4e4e3e911", "type": "in" }, { "name": "debug_in_flow", "id": "2bc15f93-4455-4763-89b8-83600fb9d731", "type": "in" }, { "name": "log_in_message", "id": "4d287cca-76ab-44ca-b22e-919fc27c50e3", "type": "in" }, { "name": "preserve_accept_header", "id": "3776b215-b3bc-40b6-bdcb-06efa7de64be", "type": "in" }, { "name": "xml_to_json_in_message", "id": "50ac2002-769e-4f90-8549-6d0248dff7d2", "type": "in" }, { "name": "xml_to_json_out_message", "id": "2af75853-ed75-4d25-81aa-0ebbeca691ea", "type": "out" }, { "name": "json_to_xml_out_message", "id": "d9fa3ffc-f6b6-4171-ab97-eb44196cb66e", "type": "out" }, { "name": "debug_out_flow", "id": "260b7701-4071-46bd-9b66-900ac6fffed6", "type": "out" }, { "name": "apply_accept_header", "id": "15c17c2f-33e3-4c37-a262-04dfa49983a4", "type": "out" }, { "name": "log_out_message", "id": "d37dca41-c048-492a-82cf-9a2292c6fff0", "type": "out" } ] }

Sample CURL

curl -k -H "Authorization: Bearer 36a1644d-16c8-3f10-af2a-cedac82a6f21" https://localhost:9443/api/am/admin/v0.15/policies/mediation

Parameters

Type Name Description Schema Default
Query

limit

optional

Maximum size of resource array to return.

Integer

25

Query

offset

optional

Starting point within the complete list of items qualified.

Integer

0

Query

query

optional

-Not supported yet-

String

Header

Accept

optional

Media types acceptable for the response. Default is application/json.

String

application/json

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. List of mediation policies is returned.

mediationList

304

Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future).

406

Not Acceptable. The requested media type is not supported

Error

Add a global mediation policy

POST https://apis.wso2.com/api/am/admin/v0.15/policies/mediation

This operation can be used to add a new global mediation policy.

OAuth 2.0 Scope

apim:mediation_policy_createi

Request

POST https://localhost:9443/api/am/admin/v0.15/policies/mediation Content-Type: application/json Authorization: Bearer 45c1e774-7d5a-3e2a-b76c-53f786efac6b { "name": "add_custom_header_fault", "type": "fault", "config": "<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"add_custom_header_fault\">\n <property name=\"CustomHeader\" scope=\"transport\" value=\"example\"/>\n<\/sequence>\n" }

Response

HTTP/1.1 201 Created Location: https://localhost:9443/api/am/admin/v0.15/registry/resource/_system/governance/apimgt/customsequences/fault/add_custom_header_fault.xml Content-Type: application/json { "id": "2e5cebbb-e48c-4345-a912-1f0a2058aa05", "name": "add_custom_header_fault", "type": "fault", "config": "<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"add_custom_header_fault\">\n <property name=\"CustomHeader\" scope=\"transport\" value=\"example\"/>\n<\/sequence>\n" }

Sample CURL

curl -k -H "Authorization: Bearer 45c1e774-7d5a-3e2a-b76c-53f786efac6b" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/admin/v0.15/policies/mediation"

Parameters

Type Name Description Schema Default
Body

body

required

mediation policy to upload

Mediation (Mediation)

Header

Content-Type

required

Media type of the entity in the body. Default is application/json.

String

application/json

Header

If-Match

optional

Validator for conditional requests; based on ETag (Will be supported in future).

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Mediation policy added successfully.

Mediation

400

Bad Request. Invalid request or validation error.

Error

404

Not Found. The resource to be updated does not exist.

Error

412

Precondition Failed. The request has not been performed because one of the preconditions is not met (Will be supported in future).

Error