create_unit
To create a new unit, use the core/create_unit method.
svc=core/create_unit¶ms={
"creatorId": <long>,
"name": "<text>",
"hwTypeId": <long>,
"dataFlags": <long>
}
Parameters
| Parameter | Description |
|---|---|
| creatorId | The ID of the user that should be the unit creator. |
| name | Unit name (4–50 characters). |
| hwTypeId | Device type ID. |
| dataFlags | Flags with the unit properties for the response (see Units). |
Response
If the request is completed successfully, the response is returned in the following format:
{
"item": { /* Created unit. */
...
},
"flags": <uint> /* Applied flags with properties. */
}
The format of the item parameter is described on the Units page.
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters, or failed to fetch the device type by ID. |
| 6 | One of the following errors:
|
| 7 | The creator belongs to a top account, or the create_units billing transaction failed. |