A
content definition describes the content of an API request, response, or parameter. You can edit
content definitions that have been previously created in various places in your API
definition.
Before you begin
Open the details form for a content definition. For details of the areas in your API
definition from where you can edit a content definition, see the following topics:
About this task
Note:
- This task relates to configuring an OpenAPI 3.0 API definition. For
details on how to configure an OpenAPI 2.0 API definition, see Editing an OpenAPI 2.0 API
definition.
- OpenAPI 3.0 APIs are supported only with the DataPower® API Gateway, not with the DataPower Gateway (v5 compatible).
- For details of current OpenAPI 3.0 support limitations, see OpenAPI 3.0 support in IBM®
API Connect.
You can complete this task either by using the API Designer UI application, or by using the
browser-based API
Manager UI.
At any time, you can switch directly to the underlying OpenAPI YAML
source by clicking the Source icon .
To return to the design form, click the Form icon .
Procedure
-
Provide the following information:
- Content Type: Select the content type; for example,
application/json.
Note: While the
Content Type field in
the editor provides a selection list of media types, by editing the OpenAPI source for the API
directly you can specify a
media type range; for example,
text/*
,
*/json
, or
*/*
. For requests or responses that match multiple
types, only the most specific type is applicable;. for example,
text/plain
overrides
text/*
.
- Schema:
To define a schema for the content definition, click
Create, then refer to Creating a schema component.
If the content definition already has a schema defined, click View
to edit the schema.
For full details on editing a schema, see
Editing a schema component.
Note: You cannot edit the schema if it references a schema
component, the schema configuration is inherited from the schema component; for details on
configuring a schema component, see
Defining schema components. You can, however,
edit the referenced schema component but any changes will be reflected anywhere that the schema
component is referenced.
- Example Value: An example of a parameter value. Whatever you enter here
is displayed as-is in the Developer Portal.
- Examples:
To add an example of the content, click
Add, then refer to Creating an example.
To edit an existing example, click the example name, then refer to Editing an example.
- Encoding: An encoding definition describes how a specific schema property
is encoded.
To add an encoding definition, click Add, then refer to Creating an encoding definition.
To edit an existing encoding definition, click
the name, then refer to Editing an encoding definition.
- Click Save when done.
What to do next
If required, use the breadcrumb trail to navigate to another
location in the hierarchy of the object you are working on.