Logo
30daysofpostman API Documentation

Create a schema

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

Creates a schema. The request body must contain a schema object with the following properties:

  • type — A string value that contains the schema's type. One of:
    • openapi3_1
    • openapi3
    • openapi2
    • openapi1
    • raml
    • raml1
    • wsdl1
    • wsdl2
    • graphql
    • proto2
    • graphql
    • proto3
  • language — A string value that contains the schema's language. One of:
    • OpenAPI and RAML — json or yaml
    • GraphQL — graphql
    • WSDL — xml
    • Protobuf — proto
  • schema — Optional. A string value that contains the schema's contents.

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

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
Content-Type
string




RESPONSES

status OK

{ "schema": { "id": "e3b3a0b7-34d5-4fc5-83e0-118bd9e8c822", "language": "yaml", "apiVersion": "ad810c39-df60-434e-a76f-a2192cd8d81f", "type": "openapi3", "createdBy": "1234567890", "updatedBy": "1234567890", "createdAt": "2021-05-22T13:17:07.000Z", "updatedAt": "2021-05-22T13:17:07.000Z" } }



Curl
curl -X POST 'https://api.getpostman.com/apis/apiId/versions/apiVersionId/schemas' -H 'Content-Type: application/json' -d '{"schema":{"language":"yaml","schema":"openapi: 3.0.0\ninfo:\n version: v1.0\n title: API\nservers:\n - url: http://localhost:3000\npaths:\n /user:\n get:\n summary: Returns details about a particular user\n operationId: listUser\n tags:\n - user\n parameters:\n - name: id\n in: query\n description: ID of the user\n required: true\n schema:\n type: integer\n format: int32\n responses:\n '200':\n description: Details about a user by ID\n headers:\n x-next:\n description: A link to the next page of responses\n schema:\n type: string\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/User'\n default:\n description: Unexpected error\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Error'\ncomponents:\n schemas:\n User:\n type: object\n required:\n - id\n - name\n properties:\n id:\n type: integer\n format: int64\n name:\n type: string\n tag:\n type: string\n Error:\n type: object\n required:\n - code\n - message\n properties:\n code:\n type: integer\n format: int32\n message:\n type: string\n","type":"openapi3"}}'

ENDPOINTS