postman
  1. postman-collections

Collections for Postman API

Syntax

To create a collection in Postman, click on the "New" button in the top left corner, then select "Collection". You can then add requests or folders to the collection by clicking the "New" button again and selecting "Request" or "Folder".

Example

Here's an example of a Postman collection that includes two requests:

{
    "info": {
        "_postman_id": "d01cfa0c-1a41-4b90-a1b5-98ef053f3193",
        "name": "Example Collection",
        "description": "An example Postman collection"
    },
    "item": [{
            "name": "Get all users",
            "request": {
                "method": "GET",
                "header": [],
                "body": {},
                "url": {
                    "raw": "https://example.com/api/users",
                    "host": [
                        "example",
                        "com"
                    ],
                    "path": [
                        "api",
                        "users"
                    ]
                }
            },
            "response": []
        },
        {
            "name": "Create new user",
            "request": {
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "raw",
                    "raw": "{\n\t\"name\": \"John\",\n\t\"email\": \"john@example.com\"\n}"
                },
                "url": {
                    "raw": "https://example.com/api/users",
                    "host": [
                        "example",
                        "com"
                    ],
                    "path": [
                        "api",
                        "users"
                    ]
                }
            },
            "response": []
        }
    ]
}

Output

The output will depend on the specific collection and requests that are included. In general, a collection will include one or more requests that can be used to interact with an API.

Explanation

Collections in Postman are a way to group together related requests and organize them for easy access. A collection can include one or more requests, as well as sub-folders to further organize the requests.

Use

Collections in Postman are a useful tool for managing and testing an API. You can use collections to group together related requests and run tests on multiple requests at once. You can also use collections to share your API with others, as a collection can be exported and shared with anyone who has access to Postman.

Important Points

  • Use descriptive names when creating requests and collections to make it easier to navigate and understand.
  • Organize requests into folders based on functionality or endpoint.
  • Use collections to test your API and ensure that it is working as expected.

Summary

Collections in Postman are a valuable tool for managing and testing an API. By organizing related requests into collections, you can streamline your development process and ensure that your API is working as expected.

Published on: