Mediation Policy (Collection)


Get all mediation policies of an API

GET https://apis.wso2.com/api/am/publisher/v0.13/apis/{apiId}/policies/mediation

This operation provides you a list of available mediation policies of an API.

OAuth 2.0 Scope

apim:api_viewi

Request

GET https://localhost:9443/api/am/publisher/v0.13/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation Authorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc

Response

HTTP/1.1 200 OK Content-Type: application/json { "count": 1, "next": null, "previous": null, "list": [ { "name": "add_custom_header_fault", "id": "6460d7e6-4272-4e3a-9879-437228d83123", "type": "fault" }] }

Sample CURL

curl -k -H "Authorization: Bearer fb2a0784-f60c-3276-8fde-5b0f70e61ecc" https://localhost:9443/api/am/publisher/v0.13/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**.

String

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 qualifying APIs 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 an API specific mediation policy

POST https://apis.wso2.com/api/am/publisher/v0.13/apis/{apiId}/policies/mediation

This operation can be used to add an API specifc mediation policy.

OAuth 2.0 Scope

apim:api_createi

Request

POST https://localhost:9443/api/am/publisher/v0.13/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation Content-Type: application/json Authorization: Bearer 6cea3696-0151-3282-bf79-a0c4db6f308a { "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/publisher/v0.13/registry/resource/_system/governance/apimgt/applicationdata/provider/admin/hello/1.0.0/fault/add_custom_header_fault.xml Content-Type: application/json { "id":"624b9f7d-bfaf-484b-94cc-e84491f5d725", "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 6cea3696-0151-3282-bf79-a0c4db6f308a" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/publisher/v0.13/apis/40082986-6488-4b86-801a-b0b069d4588c/policies/mediation"

Parameters

Type Name Description Schema Default
Body

body

required

mediation policy to upload

Mediation (Mediation)

Path

apiId

required

**API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**.

String

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 uploaded

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.

Error

Get all global level mediation policies

GET https://apis.wso2.com/api/am/publisher/v0.13/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/publisher/v0.13/policies/mediation Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK Content-Type: application/json { "count": 10, "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": "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 ae4eae22-3f65-387b-a171-d37eaa366fa8" https://localhost:9443/api/am/publisher/v0.13/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