> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/dsx-air/llms.txt.

# Create a device

POST https://api.dsx-air.nvidia.com/api/v3/simulations/devices/
Content-Type: application/json

Create a device (e.g. a NIC) under an emulated parent node. The device is emulated by the same simulator image as its parent.

**Required scope:** Simulation Edit (roles: Air Org Administrator, Air User)

Reference: https://docs.nvidia.com/dsx-air/api-reference/devices/api-v-3-simulations-devices-create

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a DeviceCreateRequest.

- `name` (string, required) — Name of this device. Must be unique across all devices on the same parent node. This name is delivered to the simulator to indicate a unique name and which interfaces are connected to it.
- `parent` (string, required) — The `id` of the emulated parent node to attach the device to.
- `emulation_type` (string, required) — The device emulation type to create (e.g. `NIC_ETHERNET`). Resolved against the parent node's simulator image.
- `model` (string, optional) — The hardware model to emulate. Defaults to the manifest default and is immutable after creation.
- `number_of_ports` (integer, optional) — The number of ports to emulate; must be one of the model's supported counts. Defaults to the model's default port count.
- `port_type` (string, optional) — The port type to emulate. Defaults to the model's default port type.
- `default_split` (string, optional) — Override the platform's default port split for the interfaces built at create. Only for a device which boots an operating system of its own: the port mappings come from that image's OS Image manifest. Ports with a custom default split keep it, and ports that do not support this split keep the platform's `default_split`.
- `pci_config` (DevicePciConfigRequest, optional) — The PCI slot this device occupies on its parent node.
- `vm_config` (DeviceVmConfigRequest, optional) — The node this device runs, for an emulation type which boots an operating system of its own (e.g. a DPU). Required for those, and rejected for emulated hardware which boots no OS (e.g. a NIC).
- `simulator_image` (string, optional) — The `id` of a specific simulator image to emulate this device with, instead of the newest compatible one. Create-only, and only for a device which boots an operating system of its own - one which does not is emulated by its parent's simulator image.
- `simulator_config` (map from string to any, optional) — Simulator-engine configuration for the device (e.g. flags declared by the engine manifest). Keys the resolved manifest's schema does not declare are rejected, as are service-derived keys (`model`, `number_of_ports`, `port_type`, `pci_address`, `pci_index`) - set those via their own fields.

## Response

### 201

- `id` (string, required)
- `created` (datetime, required)
- `modified` (datetime, required)
- `name` (string, required) — Name of this device. Must be unique across all devices on the same parent node. This name is delivered to the simulator to indicate a unique name and which interfaces are connected to it.
- `emulation_type` (string, required) — The emulation type of this device (e.g. `NIC_ETHERNET`).
- `model` (string, required) — The hardware model this device emulates (e.g. `connectx7`).
- `number_of_ports` (integer, required, nullable) — The number of ports this device emulates. Resolved at create, so it can differ from what was requested. `null` when the platform declares no port count.
- `port_type` (string, required, nullable) — The port type this device emulates (e.g. `ethernet`). `null` when neither the request nor the model's default set one.
- `default_split` (string, required, nullable) — The port split override this device was created with. `null` for a device with no OS of its own, and when it uses the platform's own default split.
- `parent` (string, required) — The `id` of the emulated node this device is plugged into.
- `pci_config` (DevicePciConfig, required) — The PCI slot this device occupies on its parent node.
- `vm_config` (DeviceVmConfigReadField, required) — The node this device runs. Empty for emulated hardware which boots no operating system of its own.
- `simulator_config` (map from string to any, required) — Simulator-engine configuration for this device. The service-derived keys (`model`, `number_of_ports`, `port_type`, `pci_address`, `pci_index`) are excluded - they surface as their own fields.
- `has_os` (boolean, required) — Whether this device boots an operating system of its own (e.g. a DPU), rather than being emulated hardware with no OS to run (e.g. a NIC). Tells which children accept instructions, resets and console access.

## Errors

### 400 Bad Request Error

- `detail` (string, required) — Description of an error.
- `request_id` (string, required, nullable) — ID assigned to the request which encountered the error. Should be provided when opening a support case.
- `type` (enum, required) — Specific type of a 400 error. * `PROTECTED` - Instance may not be deleted as it is being referenced by other instances. * `VALIDATION` - Validation errors encountered during payload processing.
  - Allowed values: `PROTECTED`, `VALIDATION`
- `protected_instances` (list of ProtectedErrorInstance, optional) — Instances which bar the current instance from being deleted. Only defined when `type` is set to `PROTECTED`.
- `validation_errors` (BadRequestValidationErrors, optional) — Validation errors encountered during payload processing. Only defined when `type` is set to `VALIDATION`.

### 403 Forbidden Error

- `detail` (string, required) — Description of an error.
- `request_id` (string, required, nullable) — ID assigned to the request which encountered the error. Should be provided when opening a support case.

### 500 Internal Server Error

- `request_id` (string, required, nullable) — ID assigned to the request which encountered the error. Should be provided when opening a support case.
- `code` (string, required) — Error code which identifies the error. Should be provided when opening a support case.
- `detail` (string, optional, default: An unexpected error has occurred. Please contact NVIDIA Air support for further assistance.) — Description of an error.

## Types

### DevicePciConfigRequest

The PCI slot a device occupies on its parent node.

- `pci_address` (string, optional) — Address of this device on its parent, in BDF notation (e.g. `0000:1a:00.0`). Auto-assigned to the next free slot when omitted.

### DeviceVmConfigRequest

The node-side configuration of a device which boots its own OS. Only meaningful for a device whose emulation type runs an operating system (e.g. a DPU); emulated hardware with no OS has no node to configure.

- `image` (string, required) — The image representing the operating system of the node.
- `cpu` (integer, optional) — Number of CPU cores.
- `memory` (integer, optional) — RAM, in MiB.
- `storage` (integer, optional) — Primary boot disk space, in GB.
- `pos_x` (integer, optional) — The horizontal coordinate position in the UI.
- `pos_y` (integer, optional) — The vertical coordinate position in the UI.
- `labels` (NodeAttributesRequest, optional) — Labels which can be specified on the node. Fields not specified in the payload schema will be completely ignored. If updating, the data provided will completely replace existing labels: attempting to PATCH specific labels will delete the other labels.
- `metadata` (string, optional, nullable) — Custom metadata as a JSON string. This field does not affect the runtime of the node or simulation. It is provided for clients to store metadata about the node for their own purposes.
- `advanced` (NodeAdvancedFieldRequest, optional) — Advanced configuration associated with the node.
- `cdrom` (CDROMAssignmentRequest, optional, nullable) — CD-ROM assignment for this node. Provide `{"image": <id>}` to attach or replace the CD-ROM image, or `null` to eject.
- `storage_pci` (map from string to TopologyFormatStoragePCIFieldRequest, optional, nullable) — Storage PCI elements associated with the node.
- `management_mac` (string, optional) — Write-only legacy alias for the `eth0` entry of `management_interfaces`. The MAC address of the management interface.
- `management_ip` (string, optional) — Write-only legacy alias for the `eth0` entry of `management_interfaces`. The IPv4 address of the management interface.
- `management_interfaces` (map from string to ManagementInterfaceEntryRequest, optional) — Dict mapping interface names (e.g. "eth0", "eth1") to management address info with optional keys "ip" (IPv4) and "mac_address". Mutually exclusive with management_ip and management_mac.
- `cpu_arch` (enum, optional) — The CPU architecture to emulate, when it differs from the architecture of the device's own OS image - e.g. an ARM guest on an x86 simulator. Defaults to the image architecture. * `x86` - x86 * `ARM` - ARM
  - Allowed values: `x86`, `ARM`
- `os_template_version` (string, optional) — Pin the OS Template version the device node resolves, instead of the default its OS Image manifest points at.
- `platform_information_version` (string, optional) — Pin the Platform Information version the device node resolves, instead of the default its manifest points at.

### DevicePciConfig

The PCI slot a device occupies on its parent node.

- `pci_address` (string, optional) — Address of this device on its parent, in BDF notation (e.g. `0000:1a:00.0`). Auto-assigned to the next free slot when omitted.

### DeviceVmConfigReadField

Renders the node a device runs, or an empty block when it has none.

- `image` (string, required) — The image representing the operating system of the node.
- `cloud_init` (CloudInitAssignment, required) — Cloud-Init assignment for this node, if any.
- `console_password` (string, required) — The password used when signing into a node using the Web UI console as well as the VNC console.
- `cpu` (integer, optional) — Number of CPU cores.
- `memory` (integer, optional) — RAM, in MiB.
- `storage` (integer, optional) — Primary boot disk space, in GB.
- `pos_x` (integer, optional) — The horizontal coordinate position in the UI.
- `pos_y` (integer, optional) — The vertical coordinate position in the UI.
- `labels` (NodeAttributes, optional) — Labels which can be specified on the node. Fields not specified in the payload schema will be completely ignored. If updating, the data provided will completely replace existing labels: attempting to PATCH specific labels will delete the other labels.
- `metadata` (string, optional, nullable) — Custom metadata as a JSON string. This field does not affect the runtime of the node or simulation. It is provided for clients to store metadata about the node for their own purposes.
- `advanced` (NodeAdvancedField, optional) — Advanced configuration associated with the node.
- `cdrom` (CDROMAssignment, optional, nullable) — CD-ROM assignment for this node. Provide `{"image": <id>}` to attach or replace the CD-ROM image, or `null` to eject.
- `storage_pci` (map from string to TopologyFormatStoragePCIField, optional, nullable) — Storage PCI elements associated with the node.
- `management_interfaces` (map from string to ManagementInterfaceEntry, optional) — Dict mapping interface names (e.g. "eth0", "eth1") to management address info with optional keys "ip" (IPv4) and "mac_address". Mutually exclusive with management_ip and management_mac.

### ProtectedErrorInstance

Identifier of a protected instance.

- `id` (string, required) — ID of the instance.
- `type` (string, required) — Type of the instance.

### BadRequestValidationErrors

Validation errors encountered during payload processing. Only defined when `type` is set to `VALIDATION`.

- map from string to BadRequestValidationErrorsOneOf0
- list of BadRequestValidationErrorsOneOf1Items

### NodeAttributesRequest

Node labels exposed in the API, stored internally as `attributes`.

- `group` (string, optional) — The group of the node.
- `model` (string, optional) — The model of the node.
- `sku` (string, optional) — The SKU of the node.
- `rack_name` (string, optional) — The name of the rack the node is part of.
- `rack_unit` (integer, optional) — The unit number within a rack for the node.
- `scalable_unit` (integer, optional) — The scalable unit number that the node belongs to.
- `rail_index` (integer, optional) — The rail index that the node belongs to.
- `data_hall` (string, optional) — The name of the data hall that the node is part of.
- `tray_index` (integer, optional) — The tray index of the node.
- `role` (string, optional) — The role of the node, e.g. leaf.
- `pod` (integer, optional) — The pod number that the node belongs to.
- `superspine_group` (integer, optional) — The superspine group number that the node belongs to.
- `plane_id` (integer, optional) — Plane identifier in a multi-plane fabric.

### NodeAdvancedFieldRequest

Advanced configuration associated with the node.

- `nic_model` (enum, optional, default: virtio) — Indicates the model to use for the node's network interfaces. * `virtio` - VirtIO * `e1000` - Intel E1000
  - Allowed values: `virtio`, `e1000`
- `cpu_mode` (enum, optional, default: custom) — Indicates the CPU mode of the node. Can only be set for entities without an `emulation_type` set. * `custom` - Custom CPU mode which can include custom CPU options. * `host-model` - CPU mode which attempts to select a CPU model resembling the hypervisor's CPU model as closely as possible. * `host-passthrough` - CPU mode which exposes all details of the hypervisor's CPU model.
  - Allowed values: `custom`, `host-model`, `host-passthrough`
- `cpu_options` (list of enum, optional) — Indicates the CPU options of the node. CPU mode must be set to `custom` for CPU options to be used. Can only be set for entities without an `emulation_type` set.
  - Allowed values: `ssse3`, `sse4.1`, `sse4.2`, `popcnt`
- `secureboot` (boolean, optional, default: false) — Indicates whether the node should perform a SecureBoot. UEFI must be enabled for SecureBoot to be used. Can only be set for entities without an `emulation_type` set.
- `uefi` (boolean, optional, default: false) — Indicates whether the node should use UEFI. Can only be set for entities without an `emulation_type` set.
- `boot` (list of enum, optional, default: hd) — Indicates how the node should boot. Accepts either a single device (legacy form, e.g. 'hd' or 'network') or a list of 1..3 unique devices for ordered fall-through (e.g. ['hd', 'network']).
  - Allowed values: `hd`, `network`, `cdrom`

### CDROMAssignmentRequest

Assignment of a CD-ROM image to a node.

- `image` (string, required) — Image to insert into the node CD-ROM drive.

### TopologyFormatStoragePCIFieldRequest

Serializer for the `StoragePCI` field.

- `type` (enum, required) — Type of the storage PCI device * `NVME` - NVMe SSD Drive
  - Allowed values: `NVME`
- `size` (integer, required) — Size of the storage PCI device in GB
- `name` (string, optional) — Name of the storage PCI device. If not provided, a default name will be assigned in the format `nvme-<index+1>`. The name must contain only letters, numbers, and hyphens and be less than 20 characters

### ManagementInterfaceEntryRequest

An entry in the `management_interfaces` PATCH dict.

- `ip` (string, required, nullable) — IPv4 address for this management interface on the OOB network. Must be within 192.168.0.0/16 and not end in .255 (broadcast). Set to `null` to opt this interface out of OOB-managed DHCP (interface is still wired to the leaf switch, but no ManagementAddress or dhcpd host entry is created).
- `mac_address` (string, required) — Unicast MAC address for this management interface.

### CloudInitAssignment

Assignment of Cloud-Init configs for a specific node. This can be used as a NoCloud data source.

- `user_data_name` (string, required) — Name of the assigned user-data config.
- `meta_data_name` (string, required) — Name of the assigned meta-data config.
- `user_data` (string, optional, nullable) — User data config to assign to the node. Supported MIME types are based on the operating system's `cloud-init` service version.
- `meta_data` (string, optional, nullable) — Meta data config to assign to the node (specific to NoCloud datasource).

### NodeAttributes

Node labels exposed in the API, stored internally as `attributes`.

- `group` (string, optional) — The group of the node.
- `model` (string, optional) — The model of the node.
- `sku` (string, optional) — The SKU of the node.
- `rack_name` (string, optional) — The name of the rack the node is part of.
- `rack_unit` (integer, optional) — The unit number within a rack for the node.
- `scalable_unit` (integer, optional) — The scalable unit number that the node belongs to.
- `rail_index` (integer, optional) — The rail index that the node belongs to.
- `data_hall` (string, optional) — The name of the data hall that the node is part of.
- `tray_index` (integer, optional) — The tray index of the node.
- `role` (string, optional) — The role of the node, e.g. leaf.
- `pod` (integer, optional) — The pod number that the node belongs to.
- `superspine_group` (integer, optional) — The superspine group number that the node belongs to.
- `plane_id` (integer, optional) — Plane identifier in a multi-plane fabric.

### NodeAdvancedField

Advanced configuration associated with the node.

- `nic_model` (enum, optional, default: virtio) — Indicates the model to use for the node's network interfaces. * `virtio` - VirtIO * `e1000` - Intel E1000
  - Allowed values: `virtio`, `e1000`
- `cpu_mode` (enum, optional, default: custom) — Indicates the CPU mode of the node. Can only be set for entities without an `emulation_type` set. * `custom` - Custom CPU mode which can include custom CPU options. * `host-model` - CPU mode which attempts to select a CPU model resembling the hypervisor's CPU model as closely as possible. * `host-passthrough` - CPU mode which exposes all details of the hypervisor's CPU model.
  - Allowed values: `custom`, `host-model`, `host-passthrough`
- `cpu_options` (list of enum, optional) — Indicates the CPU options of the node. CPU mode must be set to `custom` for CPU options to be used. Can only be set for entities without an `emulation_type` set.
  - Allowed values: `ssse3`, `sse4.1`, `sse4.2`, `popcnt`
- `secureboot` (boolean, optional, default: false) — Indicates whether the node should perform a SecureBoot. UEFI must be enabled for SecureBoot to be used. Can only be set for entities without an `emulation_type` set.
- `uefi` (boolean, optional, default: false) — Indicates whether the node should use UEFI. Can only be set for entities without an `emulation_type` set.
- `boot` (list of enum, optional, default: hd) — Indicates how the node should boot. Accepts either a single device (legacy form, e.g. 'hd' or 'network') or a list of 1..3 unique devices for ordered fall-through (e.g. ['hd', 'network']).
  - Allowed values: `hd`, `network`, `cdrom`

### CDROMAssignment

Assignment of a CD-ROM image to a node.

- `image` (string, required) — Image to insert into the node CD-ROM drive.

### TopologyFormatStoragePCIField

Serializer for the `StoragePCI` field.

- `type` (enum, required) — Type of the storage PCI device * `NVME` - NVMe SSD Drive
  - Allowed values: `NVME`
- `size` (integer, required) — Size of the storage PCI device in GB
- `name` (string, optional) — Name of the storage PCI device. If not provided, a default name will be assigned in the format `nvme-<index+1>`. The name must contain only letters, numbers, and hyphens and be less than 20 characters

### ManagementInterfaceEntry

An entry in the `management_interfaces` PATCH dict.

- `ip` (string, required, nullable) — IPv4 address for this management interface on the OOB network. Must be within 192.168.0.0/16 and not end in .255 (broadcast). Set to `null` to opt this interface out of OOB-managed DHCP (interface is still wired to the leaf switch, but no ManagementAddress or dhcpd host entry is created).
- `mac_address` (string, required) — Unicast MAC address for this management interface.

### BadRequestValidationErrorsOneOf0

- list of BadRequestValidationErrorsOneOf0OneOf0Items
- BadRequestValidationErrorsOneOf01
- map from string to any

### BadRequestValidationErrorsOneOf1Items

A single validation error.

- `message` (string, required) — Human-readable description of the error.
- `code` (string, required) — Machine-readable identifier for the error, for branching in client code. DRF supplies the default (e.g. `invalid`, `required`, `unique`); Air sets its own where a generic code would hide the cause, such as `protected` when a delete is refused because another instance still references this one.

### BadRequestValidationErrorsOneOf0OneOf0Items

A single validation error.

- `message` (string, required) — Human-readable description of the error.
- `code` (string, required) — Machine-readable identifier for the error, for branching in client code. DRF supplies the default (e.g. `invalid`, `required`, `unique`); Air sets its own where a generic code would hide the cause, such as `protected` when a delete is refused because another instance still references this one.

### BadRequestValidationErrorsOneOf01

A single validation error.

- `message` (string, required) — Human-readable description of the error.
- `code` (string, required) — Machine-readable identifier for the error, for branching in client code. DRF supplies the default (e.g. `invalid`, `required`, `unique`); Air sets its own where a generic code would hide the cause, such as `protected` when a delete is refused because another instance still references this one.

## Examples

**Request**

```json
{
  "name": "string",
  "parent": "string",
  "emulation_type": "string"
}
```

**Response**

```json
{
  "id": "string",
  "created": "2024-01-15T09:30:00Z",
  "modified": "2024-01-15T09:30:00Z",
  "name": "string",
  "emulation_type": "string",
  "model": "string",
  "number_of_ports": 1,
  "port_type": "string",
  "default_split": "string",
  "parent": "string",
  "pci_config": {
    "pci_address": "string"
  },
  "vm_config": {
    "image": "string",
    "cloud_init": {
      "user_data_name": "string",
      "meta_data_name": "string",
      "user_data": "string",
      "meta_data": "string"
    },
    "console_password": "string",
    "cpu": 1,
    "memory": 1,
    "storage": 1,
    "pos_x": 1,
    "pos_y": 1,
    "labels": {
      "group": "string",
      "model": "string",
      "sku": "string",
      "rack_name": "string",
      "rack_unit": 1,
      "scalable_unit": 1,
      "rail_index": 1,
      "data_hall": "string",
      "tray_index": 1,
      "role": "string",
      "pod": 1,
      "superspine_group": 1,
      "plane_id": 1
    },
    "metadata": "string",
    "advanced": {
      "nic_model": "virtio",
      "cpu_mode": "custom",
      "cpu_options": [
        "ssse3"
      ],
      "secureboot": false,
      "uefi": false,
      "boot": [
        "hd"
      ]
    },
    "cdrom": {
      "image": "string"
    },
    "storage_pci": {},
    "management_interfaces": {}
  },
  "simulator_config": {},
  "has_os": true
}
```

**SDK Code**

```python
import requests

url = "https://api.dsx-air.nvidia.com/api/v3/simulations/devices/"

payload = {
    "name": "string",
    "parent": "string",
    "emulation_type": "string"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.dsx-air.nvidia.com/api/v3/simulations/devices/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"string","parent":"string","emulation_type":"string"}'
};

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

```go
package main

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

func main() {

	url := "https://api.dsx-air.nvidia.com/api/v3/simulations/devices/"

	payload := strings.NewReader("{\n  \"name\": \"string\",\n  \"parent\": \"string\",\n  \"emulation_type\": \"string\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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
require 'uri'
require 'net/http'

url = URI("https://api.dsx-air.nvidia.com/api/v3/simulations/devices/")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"string\",\n  \"parent\": \"string\",\n  \"emulation_type\": \"string\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.dsx-air.nvidia.com/api/v3/simulations/devices/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\",\n  \"parent\": \"string\",\n  \"emulation_type\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.dsx-air.nvidia.com/api/v3/simulations/devices/', [
  'body' => '{
  "name": "string",
  "parent": "string",
  "emulation_type": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.dsx-air.nvidia.com/api/v3/simulations/devices/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"string\",\n  \"parent\": \"string\",\n  \"emulation_type\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "string",
  "parent": "string",
  "emulation_type": "string"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.dsx-air.nvidia.com/api/v3/simulations/devices/")! 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()
```