Definition
The definition of a REST API proxy is its OpenAPI document. It lists the resources that the API exposes, where each resource is an HTTP method and a path, such as GET /books/{id}.
On the Definition page, you can view the definition as YAML or JSON, add and delete resources, edit the definition directly, replace it with another contract, and download it.
Open the Definition Page
- Sign in to the API Control Plane Console.
- In the header, select the project from the Projects list and the API from the APIs list.
- In the left navigation menu, click Develop, then click Definition.
The definition opens as source, in a read-only editor.
- To switch the source between YAML and JSON, select YAML or JSON.
- To see the resources as a list instead of source, click View Resources. To go back to the source, click View Definition.
Add a Resource
-
Click View Resources.
-
Click Add resource.
-
In the Add Resource dialog box, enter the following details, and click Add.
Field Description Method The HTTP method, such as GETorPOST.Path The resource path. Write a path parameter in curly braces, for example, /orders/{id}/cancel.Description Optional. A short description of the resource. -
Click Save, and in the Update API dialog box, click Save again.
Delete a Resource
- Click View Resources.
- Find the resource. You can search by path, or filter by HTTP method.
- Click the delete icon next to the resource.
- Click Save, and in the Update API dialog box, click Save again.
Edit the Definition
- In the source view, click Edit.
- Change the definition in the editor.
- Click Save. The console validates the definition first. If the definition isn't a valid OpenAPI document, the console lists the errors instead of saving it.
- In the Update API dialog box, click Save.
To discard your changes before you save, click Reset.
Import a Definition
Importing replaces the whole definition with another OpenAPI 3.x contract. The console doesn't accept Swagger 2.x contracts.
-
Click the Import Definition (upload) icon.
-
In the Update OpenAPI Definition dialog box, do one of the following:
- Paste the contract URL, and click Fetch specification.
- Click Upload Specification, and select a
.json,.yaml, or.ymlfile.
-
Review the imported definition in the editor, and click Save.
-
In the Update API dialog box, click Save.
Download the Definition
- Select YAML or JSON for the format you want.
- Click the Download Definition icon.
The console downloads the saved definition as api_definition.yaml or api_definition.json. Unsaved changes aren't included.
Apply the Changes to a Gateway
Saving the definition changes the API in the API Control Plane only. To apply the changes to a gateway, deploy the API again. See Deploy an API.
Was this page helpful?