Configuring custom content-types

An API Provider can configure custom content-types based on how the payloads in the incoming or outgoing requests have to be processed.

About this task

If the native API consumes some custom content-type, the API Provider can configure a mapping between this custom content-type and a base content-type so that the schema validation, and identification in the policies are performed based on the base type.

For example, a native API consumes application/xyz content-type. The API provider creates an API for this native API and enforces the Validate API Specification policy and the API definition has schema mapping for application/json. When the request reaches webMethods API Gateway and as there is no content-type schema mapping for application/xyz, the schema validation is skipped. In such scenarios, if the API provider creates a custom content-type mapping in the webMethods API Gateway UI with the content type as application/xyz and base type as JSON, then the payload in the incoming request is validated against the JSON schema.

The following table explains the different identifiers and payload validation criteria that can be used for various content types that you can use to configure your custom content-types.

Content-type Identifier Payload validation
  • application/xml
  • text/xml
  • text/html
  • multipart/form-data
  • multipart/mixed
XPath XML schema
  • application/json
  • application/json/badgerfish
JSONPath JSON schema
text/plain Regex Regex
Note: The custom content-type feature is not supported for the SOAP to REST transformed APIs.

When you configure a custom content-type, you must specify what base-type the content type is while processing the content.

You must have the Manage general administration configurations privilege to configure custom content-type.

Procedure

  1. Open the menu options and select Administration.
  2. Select General > Custom Content-types.
  3. Provide the Content-type that has to be configured.
  4. Select the Base type as one of the following:
    • JSON. Specifies that the base-type for the provided Content-type is set to JSON.
    • XML. Specifies that the base-type for the provided Content-type is set to XML.
    • Text. Specifies that the base-type for the provided Content-type is set to plain text.
  5. Click +Add.
    You can configure multiple custom content-types by clicking Add.