Create Collection from Schema
POST https://api.getpostman.com/apis/{{apiId}}/collections
Create Collection from Schema
Creates a Collection and links it to an API in the API Builder.
Overview
Body tab
Request body requires two keys:
name
— A string of the new Collection's name.operationType
— A string that indicates the type of operation during the Collection's creation (see options below).
For the value of the operationType
your options are:
COPY_COLLECTION
— Copies a Collection from the workspace and adds it to an API.CREATE_NEW
— Creates a new Collection by providing the new Collection's content.GENERATE_FROM_SCHEMA
— Generates the Collection from an API schema.
Pre-request Script tab
Sends a message to the Console that the Request is starting to create a new Collection from the API schema.
Tests tab
- Checks for a 201 HTTP response to confirm that the new Collection from the Schema has been created.
- Parse the Response.
- Sets the new ID as the value for
collectionUid
Collection Variable.
Request Body
{"operationType"=>"GENERATE_FROM_SCHEMA", "name"=>"Scaffolded Collection | {{today}}"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Accept | string |
RESPONSES
status: OK
{"collection":{"id":"e6b0d46a-8722-4f42-ab86-f5f473187ddf","uid":"112098-e6b0d46a-8722-4f42-ab86-f5f473187ddf"},"relations":[{"type":"contracttest","id":"4b40f06a-5a6a-448f-bfcd-a6dbcb68da22"}]}