Logo
30 Days of Postman exercises API Documentation

API-Schema

Number of APIs: 4


1. Create collection from schema

POST https://api.getpostman.com/apis/{{apiId}}/versions/{{apiVersionId}}/schemas/{{schemaId}}/collections?workspace=c90a3482-f80d-43d6-9dfb-0830f5e43605

This call creates a collection and links it to an API as one or multiple relations.

Request body requires two keys: - name - Name of the collection to be created. - relations - A list of relation(s) to be created.

The allowed relation types are contracttest, integrationtest, testsuite, and documentation.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



2. Create Schema

POST https://api.getpostman.com/apis/{{apiId}}/versions/{{apiVersionId}}/schemas

This call creates a new schema.

Request body should contain a schema object which should atleast have these properties with string values:

  • type: Allowed types are openapi3, openapi2, openapi1, raml and graphql.
  • language : Allowed languages are json and yaml for OpenAPI and RAML schema types. GraphQL schema type accepts only graphql language.
  • schema: Optional. If passed, must be the content of the schema as a string.

Response contains a schema object with all the details related to the created schema, namely, id, language, type etc.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



3. Update Schema

PUT https://api.getpostman.com/apis/{{apiId}}/versions/{{apiVersionId}}/schemas/{{schemaId}}

This call updates an existing schema.

Request body should contain a schema object which should atleast have these properties with string values:

  • type: Allowed types are openapi3, openapi2, openapi1, raml and graphql.
  • language : Allowed languages are json and yaml for OpenAPI and RAML schema types. GraphQL schema type accepts only graphql language.
  • schema: Optional. If passed, must be the content of the schema as a string.

Response contains a schema object with all the details related to the created schema, namely, id, language, type etc.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



4. Get Schema

GET https://api.getpostman.com/apis/{{apiId}}/versions/{{apiVersionId}}/schemas/{{schemaId}}

This call fetches a single schema having the specified id.

Response contains a schema object with all the details related to the schema, namely, id, language, type, schema etc.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



ENDPOINTS