> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Create a request

POST https://api.postman.com/collections/{collectionId}/requests
Content-Type: application/json

Creates a request in a collection. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).

**Note:**

It is recommended that you pass the `name` property in the request body. If you do not, the system uses a null value. As a result, this creates a request with a blank name.


Reference: https://learning.postman.com/api-docs/api-reference/collection-items/create-collection-request

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `collectionId` (string, required) — The collection's ID.

### Query parameters

- `folder` (string, optional) — The folder ID in which to create the request. By default, the system creates the request at the collection level.

### Body (application/json)

This endpoint expects a createCollectionRequest.

- `name` (string, optional) — The request's name. It is recommended that you pass the `name` property in the request body. If you do not, the system uses a null value. As a result, this creates a request with a blank name.
- `description` (string, optional, nullable) — The request's description.
- `method` (enum, optional) — The request's HTTP method.
  - Allowed values: `GET`, `PUT`, `POST`, `PATCH`, `DELETE`, `COPY`, `HEAD`, `OPTIONS`, `LINK`, `UNLINK`, `PURGE`, `LOCK`, `UNLOCK`, `PROPFIND`, `VIEW`
- `url` (string, optional, nullable) — The request's URL.
- `headerData` (list of RequestHeaderDataItems, optional) — The request's headers.
- `queryParams` (list of RequestQueryParamsItems, optional) — The request's query parameters.
- `dataMode` (enum, optional) — The request body's data mode.
  - Allowed values: `raw`, `urlencoded`, `formdata`, `binary`, `graphql`
- `data` (list of RequestDataItems, optional) — The request body's form or urlencoded data.
- `rawModeData` (string, optional, nullable) — The request body's raw mode data.
- `graphqlModeData` (request-graphql-mode-data, optional) — The request body's GraphQL mode data.
- `dataOptions` (request-data-options, optional) — Additional options for the request body data.
- `auth` (request-auth, optional) — The request's authorization settings.
- `events` (list of RequestEventsItems, optional) — The request's pre-request and test scripts.

## Response

### 200

Successful Response

- `data` (CreateCollectionRequestResponseData, optional) — Information about the created request. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).
- `meta` (map from string to any, optional) — A Postman-specific response that contains information about the internal performed operation.
- `model_id` (string, optional) — The request's ID.
- `revision` (double, optional) — An internal revision ID. Its value increments each time the resource changes. You can use this ID to track whether there were changes since the last time you fetched the resource.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (CommonErrorNameMessageDetailsError, optional) — Information about the error.

### 401 Unauthorized Error

Unauthorized

- `error` (CommonErrorNameMessageDetailsError, optional) — Information about the error.

### 500 Internal Server Error

Internal Server Error

- `CreateCollectionRequestRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### RequestHeaderDataItems

- `key` (string, optional) — The header's key.
- `value` (string, optional) — The header's value.
- `description` (string, optional) — The header's description.

### RequestQueryParamsItems

- `key` (string, optional) — The query parameter's key.
- `value` (string, optional) — The query parameter's value.
- `description` (string, optional) — The query parameter's description.
- `enabled` (boolean, optional) — If true, the query parameter is enabled.

### RequestDataItems

- `key` (string, optional) — The form data's key.
- `value` (string, optional) — The form data's value.
- `description` (string, optional) — The form data's description.
- `enabled` (boolean, optional) — If true, the form data entry is enabled.
- `type` (enum, optional) — The form data's type.
  - Allowed values: `text`, `file`
- `uuid` (string, optional) — The form data entry's unique identifier.

### request-graphql-mode-data

The request body's GraphQL mode data.

- `query` (string, optional) — The GraphQL query.
- `variables` (string, optional) — The GraphQL query variables, in JSON format.

### request-data-options

Additional configurations and options set for the request body's various data modes.

- `raw` (RequestDataOptionsRaw, optional) — Options for the `raw` data mode.
- `urlencoded` (RequestDataOptionsUrlencoded, optional) — Options for the `urlencoded` data mode.
- `params` (RequestDataOptionsParams, optional) — Options for the `params` data mode.
- `binary` (RequestDataOptionsBinary, optional) — Options for the `binary` data mode.
- `graphql` (RequestDataOptionsGraphql, optional) — Options for the `graphql` data mode.

### request-auth

The request's authentication information.

- `type` (enum, required) — The authorization type.
  - Allowed values: `basic`, `bearer`, `apikey`, `digest`, `oauth1`, `oauth2`, `hawk`, `awsv4`, `ntlm`, `edgegrid`, `jwt`, `asap`, `noauth`
- `apikey` (list of auth-attribute, optional) — The API key's authentication information.
- `awsv4` (list of auth-attribute, optional) — The attributes for AWS Signature authentication.
- `basic` (list of auth-attribute, optional) — The attributes for Basic Auth.
- `bearer` (list of auth-attribute, optional) — The attributes for Bearer Token authentication.
- `digest` (list of auth-attribute, optional) — The attributes for Digest access authentication.
- `edgegrid` (list of auth-attribute, optional) — The attributes for Akamai Edgegrid authentication.
- `hawk` (list of auth-attribute, optional) — The attributes for Hawk authentication.
- `ntlm` (list of auth-attribute, optional) — The attributes for NTLM authentication.
- `oauth1` (list of auth-attribute, optional) — The attributes for OAuth1 authentication.
- `oauth2` (list of auth-attribute, optional) — The attributes for OAuth2 authentication.
- `jwt` (list of auth-attribute, optional) — The attributes for JWT authentication.
- `asap` (list of auth-attribute, optional) — The attributes for ASAP authentication.

### RequestEventsItems

- `listen` (enum, optional) — The event type.
  - Allowed values: `test`, `prerequest`
- `script` (script-2, optional) — Information about the Javascript code that can be used to to perform setup or teardown operations in a response.

### CreateCollectionRequestResponseData

Information about the created request. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).

- `id` (string, optional) — The request's ID.
- `name` (string, optional) — The request's name.
- `owner` (string, optional) — The user ID of the request's owner.
- `folder` (string, optional, nullable) — Information about the request's parent folder.
- `responses` (list of string, optional) — A list of the request's responses.
- `collection` (string, optional) — The collection ID that the request belongs to.
- `responses_order` (list of string, optional) — A list of response IDs and their order in the folder.
- `createdAt` (datetime, optional) — The requeset's creation date and time.
- `updatedAt` (datetime, optional) — The date and time at which the request was last updated.
- `lastUpdatedBy` (string, optional) — The user ID of the user that last updated the folder.

### CommonErrorNameMessageDetailsError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.
- `details` (CommonErrorNameMessageDetailsErrorDetails, optional) — Information about the error.

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### RequestDataOptionsRaw

Options for the `raw` data mode.

- `language` (string, optional) — The raw mode data's language type.

### RequestDataOptionsUrlencoded

Options for the `urlencoded` data mode.

### RequestDataOptionsParams

Options for the `params` data mode.

### RequestDataOptionsBinary

Options for the `binary` data mode.

### RequestDataOptionsGraphql

Options for the `graphql` data mode.

### auth-attribute

Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).

- `key` (string, required) — The auth method's key value.
- `value` (AuthAttributeValue, optional) — The key's value.
- `type` (enum, optional) — The value's type.
  - Allowed values: `string`, `boolean`, `number`, `array`, `object`, `any`

### script-2

Information about the Javascript code that can be used to to perform setup or teardown operations in a response.

- `id` (string, optional) — The script's ID.
- `type` (string, optional) — The type of script. For example, `text/javascript`.
- `exec` (list of string, optional) — A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.

### CommonErrorNameMessageDetailsErrorDetails

Information about the error.

- map from string to any
- list of string

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

### AuthAttributeValue

The key's value.

- string
- array: list of AuthAttributeValueOneOf1Items

### AuthAttributeValueOneOf1Items

## Examples

### GET Request

**Request**

```json
{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
    "name": "Example GET Request",
    "owner": "12345678",
    "folder": null,
    "responses": [],
    "collection": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "responses_order": [],
    "createdAt": "2023-09-07T13:33:17.912Z",
    "updatedAt": "2023-09-07T13:33:17.912Z",
    "lastUpdatedBy": "12345678",
    "dataMode": "raw",
    "dataOptions": {
      "raw": {
        "language": "json"
      }
    },
    "description": "This is an example GET request.",
    "headerData": [],
    "headers": [
      {
        "key": "Host",
        "value": "postman-echo.com"
      },
      {
        "key": "user-agent",
        "value": "curl/7.88.1"
      },
      {
        "key": "accept",
        "value": "*/*"
      },
      {
        "key": "content-type",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "queryParams": [
      {
        "description": "Optional. The user's ID.",
        "enabled": true,
        "equals": true,
        "key": "id",
        "value": "{{id}}"
      }
    ],
    "rawModeData": null,
    "url": "https://postman-echo.com/get?param=value"
  },
  "meta": {
    "action": "import",
    "model": "request"
  },
  "model_id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
  "revision": 32456338071
}
```

**SDK Code**

```python GET Request
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

payload = {
    "name": "Example GET Request",
    "description": "This is an example GET request.",
    "method": "GET",
    "url": "https://postman-echo.com/get?param=value",
    "queryParams": [
        {
            "key": "id",
            "value": "{{id}}",
            "description": "Optional. The user's ID.",
            "enabled": True,
            "equals": True
        }
    ],
    "dataMode": "raw",
    "rawModeData": None,
    "dataOptions": { "raw": { "language": "json" } },
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript GET Request
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Example GET Request","description":"This is an example GET request.","method":"GET","url":"https://postman-echo.com/get?param=value","queryParams":[{"key":"id","value":"{{id}}","description":"Optional. The user\'s ID.","enabled":true,"equals":true}],"dataMode":"raw","rawModeData":null,"dataOptions":{"raw":{"language":"json"}},"headers":[{"key":"Host","value":"postman-echo.com"},{"key":"user-agent","value":"curl/7.88.1"},{"key":"accept","value":"*/*"},{"key":"content-type","value":"application/json"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go GET Request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

	payload := strings.NewReader("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby GET Request
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java GET Request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}")
  .asString();
```

```php GET Request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests', [
  'body' => '{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user\'s ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp GET Request
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift GET Request
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    [
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    ]
  ],
  "dataMode": "raw",
  "rawModeData": ,
  "dataOptions": ["raw": ["language": "json"]],
  "headers": [
    [
      "key": "Host",
      "value": "postman-echo.com"
    ],
    [
      "key": "user-agent",
      "value": "curl/7.88.1"
    ],
    [
      "key": "accept",
      "value": "*/*"
    ],
    [
      "key": "content-type",
      "value": "application/json"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### POST Request

**Request**

```json
{
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{\n  \"field\": \"Value\"\n}",
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    },
    {
      "key": "content-length",
      "value": "22"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
    "name": "Example POST Request",
    "owner": "12345678",
    "folder": null,
    "responses": [],
    "collection": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "responses_order": [],
    "createdAt": "2023-09-07T13:35:33.691Z",
    "updatedAt": "2023-09-07T13:35:33.691Z",
    "lastUpdatedBy": "12345678",
    "dataMode": "raw",
    "dataOptions": {
      "raw": {
        "language": "json"
      }
    },
    "headerData": [],
    "headers": [
      {
        "key": "Host",
        "value": "postman-echo.com"
      },
      {
        "key": "user-agent",
        "value": "curl/7.88.1"
      },
      {
        "key": "accept",
        "value": "*/*"
      },
      {
        "key": "content-type",
        "value": "application/json"
      },
      {
        "key": "content-length",
        "value": "22"
      }
    ],
    "method": "POST",
    "rawModeData": null,
    "url": "https://postman-echo.com/post"
  },
  "meta": {
    "action": "import",
    "model": "request"
  },
  "model_id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
  "revision": 32456382272
}
```

**SDK Code**

```python POST Request
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

payload = {
    "name": "Example POST Request",
    "method": "POST",
    "url": "https://postman-echo.com/post",
    "dataMode": "raw",
    "rawModeData": "{
  \"field\": \"Value\"
}",
    "dataOptions": { "raw": { "language": "json" } },
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        },
        {
            "key": "content-length",
            "value": "22"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript POST Request
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Example POST Request","method":"POST","url":"https://postman-echo.com/post","dataMode":"raw","rawModeData":"{\n  \"field\": \"Value\"\n}","dataOptions":{"raw":{"language":"json"}},"headers":[{"key":"Host","value":"postman-echo.com"},{"key":"user-agent","value":"curl/7.88.1"},{"key":"accept","value":"*/*"},{"key":"content-type","value":"application/json"},{"key":"content-length","value":"22"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go POST Request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

	payload := strings.NewReader("{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby POST Request
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java POST Request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}")
  .asString();
```

```php POST Request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests', [
  'body' => '{
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{\\n  \\"field\\": \\"Value\\"\\n}",
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    },
    {
      "key": "content-length",
      "value": "22"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp POST Request
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift POST Request
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{
  \"field\": \"Value\"
}",
  "dataOptions": ["raw": ["language": "json"]],
  "headers": [
    [
      "key": "Host",
      "value": "postman-echo.com"
    ],
    [
      "key": "user-agent",
      "value": "curl/7.88.1"
    ],
    [
      "key": "accept",
      "value": "*/*"
    ],
    [
      "key": "content-type",
      "value": "application/json"
    ],
    [
      "key": "content-length",
      "value": "22"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Request in a Folder

**Request**

```json
{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "389f1640-7996-b519-4747-9f3c6a350a19",
    "name": "Example",
    "owner": "20891195",
    "folder": "4249383d-2af6-4ac6-9a2b-0930e8f639e3",
    "responses": [],
    "collection": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "responses_order": [],
    "createdAt": "2023-09-13T18:03:16.957Z",
    "updatedAt": "2023-09-13T18:03:16.957Z",
    "lastUpdatedBy": "20891195",
    "dataMode": "raw",
    "dataOptions": {
      "raw": {
        "language": "json"
      }
    },
    "description": "This is an example GET request.",
    "headerData": [],
    "headers": [
      {
        "key": "Host",
        "value": "postman-echo.com"
      },
      {
        "key": "user-agent",
        "value": "curl/7.88.1"
      },
      {
        "key": "accept",
        "value": "*/*"
      },
      {
        "key": "content-type",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "queryParams": [
      {
        "description": "Optional. The user's ID.",
        "enabled": false,
        "equals": true,
        "key": "id",
        "value": "{{id}}"
      }
    ],
    "rawModeData": null,
    "url": "https://postman-echo.com/get?param=value"
  },
  "meta": {
    "action": "import",
    "model": "request"
  },
  "model_id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
  "revision": 32549528635
}
```

**SDK Code**

```python Request in a Folder
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

querystring = {"folder":"4249383d-2af6-4ac6-9a2b-0930e8f639e3"}

payload = {
    "name": "Example GET Request",
    "description": "This is an example GET request.",
    "method": "GET",
    "url": "https://postman-echo.com/get?param=value",
    "queryParams": [
        {
            "key": "id",
            "value": "{{id}}",
            "description": "Optional. The user's ID.",
            "enabled": True,
            "equals": True
        }
    ],
    "dataMode": "raw",
    "rawModeData": None,
    "dataOptions": { "raw": { "language": "json" } },
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript Request in a Folder
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Example GET Request","description":"This is an example GET request.","method":"GET","url":"https://postman-echo.com/get?param=value","queryParams":[{"key":"id","value":"{{id}}","description":"Optional. The user\'s ID.","enabled":true,"equals":true}],"dataMode":"raw","rawModeData":null,"dataOptions":{"raw":{"language":"json"}},"headers":[{"key":"Host","value":"postman-echo.com"},{"key":"user-agent","value":"curl/7.88.1"},{"key":"accept","value":"*/*"},{"key":"content-type","value":"application/json"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Request in a Folder
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3"

	payload := strings.NewReader("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Request in a Folder
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Request in a Folder
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}")
  .asString();
```

```php Request in a Folder
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3', [
  'body' => '{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user\'s ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Request in a Folder
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request in a Folder
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    [
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    ]
  ],
  "dataMode": "raw",
  "rawModeData": ,
  "dataOptions": ["raw": ["language": "json"]],
  "headers": [
    [
      "key": "Host",
      "value": "postman-echo.com"
    ],
    [
      "key": "user-agent",
      "value": "curl/7.88.1"
    ],
    [
      "key": "accept",
      "value": "*/*"
    ],
    [
      "key": "content-type",
      "value": "application/json"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests?folder=4249383d-2af6-4ac6-9a2b-0930e8f639e3")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Request with Auth

**Request**

```json
{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "value",
        "value": "XXX",
        "type": "string"
      },
      {
        "key": "key",
        "value": "api-key",
        "type": "string"
      }
    ]
  },
  "currentHelper": "apikeyAuth",
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ],
  "helperAttributes": "{\"id\":\"apikey\",\"key\":\"api-key\",\"value\":\"XXX\"}"
}
```

**Response**

```json
{
  "data": {
    "id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
    "name": "Example GET Request",
    "owner": "12345678",
    "folder": "4ec7de35-cc87-4e2f-ab01-6fd351371ad3",
    "responses": [],
    "collection": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "responses_order": [],
    "createdAt": "2022-10-07T13:57:54.145Z",
    "updatedAt": "2022-10-07T13:57:54.145Z",
    "lastUpdatedBy": "12345678",
    "auth": {
      "apikey": [
        {
          "key": "value",
          "type": "string",
          "value": "XXX"
        },
        {
          "key": "key",
          "type": "string",
          "value": "api-key"
        }
      ],
      "type": "apikey"
    },
    "currentHelper": "apikeyAuth",
    "dataMode": "raw",
    "dataOptions": {
      "raw": {
        "language": "json"
      }
    },
    "description": "This is an example GET request.",
    "headerData": [],
    "headers": "[object Object],[object Object],[object Object],[object Object]",
    "helperAttributes": "{\"id\":\"apikey\",\"key\":\"api-key\",\"value\":\"XXX\"}",
    "method": "GET",
    "queryParams": [
      {
        "description": "Optional. The user's ID.",
        "enabled": true,
        "equals": true,
        "key": "id",
        "value": "{{id}}"
      }
    ],
    "rawModeData": null,
    "url": "https://postman-echo.com/get?param=value"
  },
  "meta": {
    "action": "import",
    "model": "request"
  },
  "model_id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
  "revision": 27134451973
}
```

**SDK Code**

```python Request with Auth
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

payload = {
    "name": "Example GET Request",
    "description": "This is an example GET request.",
    "method": "GET",
    "url": "https://postman-echo.com/get?param=value",
    "queryParams": [
        {
            "key": "id",
            "value": "{{id}}",
            "description": "Optional. The user's ID.",
            "enabled": True,
            "equals": True
        }
    ],
    "dataMode": "raw",
    "rawModeData": None,
    "dataOptions": { "raw": { "language": "json" } },
    "auth": {
        "type": "apikey",
        "apikey": [
            {
                "key": "value",
                "value": "XXX",
                "type": "string"
            },
            {
                "key": "key",
                "value": "api-key",
                "type": "string"
            }
        ]
    },
    "currentHelper": "apikeyAuth",
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        }
    ],
    "helperAttributes": "{\"id\":\"apikey\",\"key\":\"api-key\",\"value\":\"XXX\"}"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Request with Auth
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Example GET Request","description":"This is an example GET request.","method":"GET","url":"https://postman-echo.com/get?param=value","queryParams":[{"key":"id","value":"{{id}}","description":"Optional. The user\'s ID.","enabled":true,"equals":true}],"dataMode":"raw","rawModeData":null,"dataOptions":{"raw":{"language":"json"}},"auth":{"type":"apikey","apikey":[{"key":"value","value":"XXX","type":"string"},{"key":"key","value":"api-key","type":"string"}]},"currentHelper":"apikeyAuth","headers":[{"key":"Host","value":"postman-echo.com"},{"key":"user-agent","value":"curl/7.88.1"},{"key":"accept","value":"*/*"},{"key":"content-type","value":"application/json"}],"helperAttributes":"{\"id\":\"apikey\",\"key\":\"api-key\",\"value\":\"XXX\"}"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Request with Auth
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

	payload := strings.NewReader("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"auth\": {\n    \"type\": \"apikey\",\n    \"apikey\": [\n      {\n        \"key\": \"value\",\n        \"value\": \"XXX\",\n        \"type\": \"string\"\n      },\n      {\n        \"key\": \"key\",\n        \"value\": \"api-key\",\n        \"type\": \"string\"\n      }\n    ]\n  },\n  \"currentHelper\": \"apikeyAuth\",\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ],\n  \"helperAttributes\": \"{\\\"id\\\":\\\"apikey\\\",\\\"key\\\":\\\"api-key\\\",\\\"value\\\":\\\"XXX\\\"}\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Request with Auth
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"auth\": {\n    \"type\": \"apikey\",\n    \"apikey\": [\n      {\n        \"key\": \"value\",\n        \"value\": \"XXX\",\n        \"type\": \"string\"\n      },\n      {\n        \"key\": \"key\",\n        \"value\": \"api-key\",\n        \"type\": \"string\"\n      }\n    ]\n  },\n  \"currentHelper\": \"apikeyAuth\",\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ],\n  \"helperAttributes\": \"{\\\"id\\\":\\\"apikey\\\",\\\"key\\\":\\\"api-key\\\",\\\"value\\\":\\\"XXX\\\"}\"\n}"

response = http.request(request)
puts response.read_body
```

```java Request with Auth
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"auth\": {\n    \"type\": \"apikey\",\n    \"apikey\": [\n      {\n        \"key\": \"value\",\n        \"value\": \"XXX\",\n        \"type\": \"string\"\n      },\n      {\n        \"key\": \"key\",\n        \"value\": \"api-key\",\n        \"type\": \"string\"\n      }\n    ]\n  },\n  \"currentHelper\": \"apikeyAuth\",\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ],\n  \"helperAttributes\": \"{\\\"id\\\":\\\"apikey\\\",\\\"key\\\":\\\"api-key\\\",\\\"value\\\":\\\"XXX\\\"}\"\n}")
  .asString();
```

```php Request with Auth
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests', [
  'body' => '{
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    {
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user\'s ID.",
      "enabled": true,
      "equals": true
    }
  ],
  "dataMode": "raw",
  "rawModeData": null,
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "value",
        "value": "XXX",
        "type": "string"
      },
      {
        "key": "key",
        "value": "api-key",
        "type": "string"
      }
    ]
  },
  "currentHelper": "apikeyAuth",
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    }
  ],
  "helperAttributes": "{\\"id\\":\\"apikey\\",\\"key\\":\\"api-key\\",\\"value\\":\\"XXX\\"}"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Request with Auth
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Example GET Request\",\n  \"description\": \"This is an example GET request.\",\n  \"method\": \"GET\",\n  \"url\": \"https://postman-echo.com/get?param=value\",\n  \"queryParams\": [\n    {\n      \"key\": \"id\",\n      \"value\": \"{{id}}\",\n      \"description\": \"Optional. The user's ID.\",\n      \"enabled\": true,\n      \"equals\": true\n    }\n  ],\n  \"dataMode\": \"raw\",\n  \"rawModeData\": null,\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"auth\": {\n    \"type\": \"apikey\",\n    \"apikey\": [\n      {\n        \"key\": \"value\",\n        \"value\": \"XXX\",\n        \"type\": \"string\"\n      },\n      {\n        \"key\": \"key\",\n        \"value\": \"api-key\",\n        \"type\": \"string\"\n      }\n    ]\n  },\n  \"currentHelper\": \"apikeyAuth\",\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    }\n  ],\n  \"helperAttributes\": \"{\\\"id\\\":\\\"apikey\\\",\\\"key\\\":\\\"api-key\\\",\\\"value\\\":\\\"XXX\\\"}\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request with Auth
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Example GET Request",
  "description": "This is an example GET request.",
  "method": "GET",
  "url": "https://postman-echo.com/get?param=value",
  "queryParams": [
    [
      "key": "id",
      "value": "{{id}}",
      "description": "Optional. The user's ID.",
      "enabled": true,
      "equals": true
    ]
  ],
  "dataMode": "raw",
  "rawModeData": ,
  "dataOptions": ["raw": ["language": "json"]],
  "auth": [
    "type": "apikey",
    "apikey": [
      [
        "key": "value",
        "value": "XXX",
        "type": "string"
      ],
      [
        "key": "key",
        "value": "api-key",
        "type": "string"
      ]
    ]
  ],
  "currentHelper": "apikeyAuth",
  "headers": [
    [
      "key": "Host",
      "value": "postman-echo.com"
    ],
    [
      "key": "user-agent",
      "value": "curl/7.88.1"
    ],
    [
      "key": "accept",
      "value": "*/*"
    ],
    [
      "key": "content-type",
      "value": "application/json"
    ]
  ],
  "helperAttributes": "{\"id\":\"apikey\",\"key\":\"api-key\",\"value\":\"XXX\"}"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Request with Tests

**Request**

```json
{
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{\n  \"field\": \"Value\"\n}",
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "events": [
    {
      "listen": "test",
      "script": {
        "id": "a8608e1a-ce4b-4129-8c89-930d26ae0f6a",
        "type": "text/javascript",
        "exec": [
          "pm.test(\"Status code is 200\", function () {",
          "    pm.response.to.have.status(200);",
          "});"
        ]
      }
    },
    {
      "listen": "prerequest",
      "script": {
        "id": "5b4bb273-5878-4bd7-a296-94a256783a66",
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ],
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    },
    {
      "key": "content-length",
      "value": "22"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
    "name": "Example POST Request",
    "owner": "12345678",
    "folder": null,
    "responses": [],
    "collection": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "responses_order": [],
    "createdAt": "2023-09-07T13:35:33.691Z",
    "updatedAt": "2023-09-07T13:35:33.691Z",
    "lastUpdatedBy": "12345678",
    "dataMode": "raw",
    "dataOptions": {
      "raw": {
        "language": "json"
      }
    },
    "events": [
      {
        "listen": "test",
        "script": {
          "exec": [
            "pm.test(\"Status code is 200\", function () {",
            "    pm.response.to.have.status(200);",
            "});"
          ],
          "id": "a8608e1a-ce4b-4129-8c89-930d26ae0f6a",
          "type": "text/javascript"
        }
      },
      {
        "listen": "prerequest",
        "script": {
          "exec": [
            ""
          ],
          "id": "5b4bb273-5878-4bd7-a296-94a256783a66",
          "type": "text/javascript"
        }
      }
    ],
    "headerData": [],
    "headers": [
      {
        "key": "Host",
        "value": "postman-echo.com"
      },
      {
        "key": "user-agent",
        "value": "curl/7.88.1"
      },
      {
        "key": "accept",
        "value": "*/*"
      },
      {
        "key": "content-type",
        "value": "application/json"
      },
      {
        "key": "content-length",
        "value": "22"
      }
    ],
    "method": "POST",
    "rawModeData": null,
    "url": "https://postman-echo.com/post"
  },
  "meta": {
    "action": "import",
    "model": "request"
  },
  "model_id": "c82dd02c-4870-4907-8fcb-593a876cf05b",
  "revision": 32456382272
}
```

**SDK Code**

```python Request with Tests
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

payload = {
    "name": "Example POST Request",
    "method": "POST",
    "url": "https://postman-echo.com/post",
    "dataMode": "raw",
    "rawModeData": "{
  \"field\": \"Value\"
}",
    "dataOptions": { "raw": { "language": "json" } },
    "events": [
        {
            "listen": "test",
            "script": {
                "id": "a8608e1a-ce4b-4129-8c89-930d26ae0f6a",
                "type": "text/javascript",
                "exec": ["pm.test(\"Status code is 200\", function () {", "    pm.response.to.have.status(200);", "});"]
            }
        },
        {
            "listen": "prerequest",
            "script": {
                "id": "5b4bb273-5878-4bd7-a296-94a256783a66",
                "type": "text/javascript",
                "exec": [""]
            }
        }
    ],
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        },
        {
            "key": "content-length",
            "value": "22"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Request with Tests
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Example POST Request","method":"POST","url":"https://postman-echo.com/post","dataMode":"raw","rawModeData":"{\n  \"field\": \"Value\"\n}","dataOptions":{"raw":{"language":"json"}},"events":[{"listen":"test","script":{"id":"a8608e1a-ce4b-4129-8c89-930d26ae0f6a","type":"text/javascript","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});"]}},{"listen":"prerequest","script":{"id":"5b4bb273-5878-4bd7-a296-94a256783a66","type":"text/javascript","exec":[""]}}],"headers":[{"key":"Host","value":"postman-echo.com"},{"key":"user-agent","value":"curl/7.88.1"},{"key":"accept","value":"*/*"},{"key":"content-type","value":"application/json"},{"key":"content-length","value":"22"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Request with Tests
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests"

	payload := strings.NewReader("{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"events\": [\n    {\n      \"listen\": \"test\",\n      \"script\": {\n        \"id\": \"a8608e1a-ce4b-4129-8c89-930d26ae0f6a\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"pm.test(\\\"Status code is 200\\\", function () {\",\n          \"    pm.response.to.have.status(200);\",\n          \"});\"\n        ]\n      }\n    },\n    {\n      \"listen\": \"prerequest\",\n      \"script\": {\n        \"id\": \"5b4bb273-5878-4bd7-a296-94a256783a66\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"\"\n        ]\n      }\n    }\n  ],\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Request with Tests
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"events\": [\n    {\n      \"listen\": \"test\",\n      \"script\": {\n        \"id\": \"a8608e1a-ce4b-4129-8c89-930d26ae0f6a\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"pm.test(\\\"Status code is 200\\\", function () {\",\n          \"    pm.response.to.have.status(200);\",\n          \"});\"\n        ]\n      }\n    },\n    {\n      \"listen\": \"prerequest\",\n      \"script\": {\n        \"id\": \"5b4bb273-5878-4bd7-a296-94a256783a66\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"\"\n        ]\n      }\n    }\n  ],\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Request with Tests
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"events\": [\n    {\n      \"listen\": \"test\",\n      \"script\": {\n        \"id\": \"a8608e1a-ce4b-4129-8c89-930d26ae0f6a\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"pm.test(\\\"Status code is 200\\\", function () {\",\n          \"    pm.response.to.have.status(200);\",\n          \"});\"\n        ]\n      }\n    },\n    {\n      \"listen\": \"prerequest\",\n      \"script\": {\n        \"id\": \"5b4bb273-5878-4bd7-a296-94a256783a66\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"\"\n        ]\n      }\n    }\n  ],\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}")
  .asString();
```

```php Request with Tests
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests', [
  'body' => '{
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{\\n  \\"field\\": \\"Value\\"\\n}",
  "dataOptions": {
    "raw": {
      "language": "json"
    }
  },
  "events": [
    {
      "listen": "test",
      "script": {
        "id": "a8608e1a-ce4b-4129-8c89-930d26ae0f6a",
        "type": "text/javascript",
        "exec": [
          "pm.test(\\"Status code is 200\\", function () {",
          "    pm.response.to.have.status(200);",
          "});"
        ]
      }
    },
    {
      "listen": "prerequest",
      "script": {
        "id": "5b4bb273-5878-4bd7-a296-94a256783a66",
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ],
  "headers": [
    {
      "key": "Host",
      "value": "postman-echo.com"
    },
    {
      "key": "user-agent",
      "value": "curl/7.88.1"
    },
    {
      "key": "accept",
      "value": "*/*"
    },
    {
      "key": "content-type",
      "value": "application/json"
    },
    {
      "key": "content-length",
      "value": "22"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Request with Tests
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Example POST Request\",\n  \"method\": \"POST\",\n  \"url\": \"https://postman-echo.com/post\",\n  \"dataMode\": \"raw\",\n  \"rawModeData\": \"{\\n  \\\"field\\\": \\\"Value\\\"\\n}\",\n  \"dataOptions\": {\n    \"raw\": {\n      \"language\": \"json\"\n    }\n  },\n  \"events\": [\n    {\n      \"listen\": \"test\",\n      \"script\": {\n        \"id\": \"a8608e1a-ce4b-4129-8c89-930d26ae0f6a\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"pm.test(\\\"Status code is 200\\\", function () {\",\n          \"    pm.response.to.have.status(200);\",\n          \"});\"\n        ]\n      }\n    },\n    {\n      \"listen\": \"prerequest\",\n      \"script\": {\n        \"id\": \"5b4bb273-5878-4bd7-a296-94a256783a66\",\n        \"type\": \"text/javascript\",\n        \"exec\": [\n          \"\"\n        ]\n      }\n    }\n  ],\n  \"headers\": [\n    {\n      \"key\": \"Host\",\n      \"value\": \"postman-echo.com\"\n    },\n    {\n      \"key\": \"user-agent\",\n      \"value\": \"curl/7.88.1\"\n    },\n    {\n      \"key\": \"accept\",\n      \"value\": \"*/*\"\n    },\n    {\n      \"key\": \"content-type\",\n      \"value\": \"application/json\"\n    },\n    {\n      \"key\": \"content-length\",\n      \"value\": \"22\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request with Tests
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Example POST Request",
  "method": "POST",
  "url": "https://postman-echo.com/post",
  "dataMode": "raw",
  "rawModeData": "{
  \"field\": \"Value\"
}",
  "dataOptions": ["raw": ["language": "json"]],
  "events": [
    [
      "listen": "test",
      "script": [
        "id": "a8608e1a-ce4b-4129-8c89-930d26ae0f6a",
        "type": "text/javascript",
        "exec": ["pm.test(\"Status code is 200\", function () {", "    pm.response.to.have.status(200);", "});"]
      ]
    ],
    [
      "listen": "prerequest",
      "script": [
        "id": "5b4bb273-5878-4bd7-a296-94a256783a66",
        "type": "text/javascript",
        "exec": [""]
      ]
    ]
  ],
  "headers": [
    [
      "key": "Host",
      "value": "postman-echo.com"
    ],
    [
      "key": "user-agent",
      "value": "curl/7.88.1"
    ],
    [
      "key": "accept",
      "value": "*/*"
    ],
    [
      "key": "content-type",
      "value": "application/json"
    ],
    [
      "key": "content-length",
      "value": "22"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/requests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```