Logo
15_Days_of_Postman_-_for_testers_IvanKo API Documentation

API-Schema

Number of APIs: 6


1. Create a schema

POST {{baseUrl}}/apis/{{apiId}}/schemas

Creates a schema for an API. Include the following in the the request body:

  • type — A string value that contains the API schema's type. One of:
    • openapi:3_1
    • openapi:3
    • openapi:2
    • openapi:1
    • raml:0_8
    • raml:1
    • wsdl:1
    • wsdl:2
    • graphql
    • proto:2
    • proto:3
    • asyncapi:2
  • files — An array of schema files that contains the following:
    • path — A string value that contains the schema file's path.
    • content — A string value that contains the schema file's stringified contents.



2. Create or update a schema file

PUT {{baseUrl}}/apis/{{apiId}}/schemas/{{schemaId}}/files/{{filePath}}

Creates or updates an API schema file. Include the following in the request body:

  • content — A string value that contains the file's contents.

Note:

  • If the provided file path exists, the file will be updated with the new contents.
  • If the provided file path does not exist, then a new schema file will be created.
  • If the file path contains a / (forward slash) character, then a folder is created. For example, if the file path is the dir/schema.json value, then a dir folder is created with the schema.json file inside.
  • You can only update the root tag for protobuf specifications.



3. Get a schema

GET {{baseUrl}}/apis/{{apiId}}/schemas/{{schemaId}}

Gets information about API schema. You can use the versionId query parameter to get a schema published in an API version.

You can use this API to do the following:

  • Get a schema's metadata.
  • Get all the files in a schema. This only returns the first file in the schema. The endpoint response contains a link to the next set of response results.
  • Get a schema's contents in multi-file or bundled format.

Note:

The versionId query parameter is a required parameter for API viewers.



4. Get schema files

GET {{baseUrl}}/apis/{{apiId}}/schemas/{{schemaId}}/files

Gets the files in an API schema. You can use the versionId query parameter to get schema files published in an API version.

Note:

The versionId query parameter is a required parameter for API viewers.



5. Get schema file contents

GET {{baseUrl}}/apis/{{apiId}}/schemas/{{schemaId}}/files/{{filePath}}

Gets an API schema file contents at the defined path. You can use the versionId query parameter to get schema file contents published in an API version.

Note:

The versionId query parameter is a required parameter for API viewers.



6. Delete a schema file

DELETE {{baseUrl}}/apis/{{apiId}}/schemas/{{schemaId}}/files/{{filePath}}

Deletes a file in an API schema.



ENDPOINTS