JSON API » machines » machines/create
Creates a new machine.
Input parameters
Requires authentication and the system role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
server | String | Hostname without domain. | Yes | |
ipaddr | String | IP address. May be IPv4 or IPv6. If possible, should be public rather than RFC1918. If the machine has multiple addresses, use the one SIP calls should be delivered to. | Yes | |
type | String | "machine" for normal machine, "service" for service IP address. | No | "machine" |
asterisk | Integer | 1 if the machine runs Asterisk, 0 if not. | No | 0 |
description | String | Description. | No | Empty string. |
domain | String | DNS domain. | No | Empty string. |
media_audio | Integer | 1 to accept audio calls, 0 if not. | No | 1 |
media_video | Integer | 1 to accept video calls, 0 if not. | No | 1 |
sip_port | Integer | Port to deliver SIP calls to. Only used if running Asterisk. | No | 5060 |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
weight | Integer | Weighting for delivering SIP calls. Only used if running Asterisk. | No | 100 |
Responses
Code | Description |
---|---|
200 | Success. |
201 | Input passed validation. Only returned if validation=1. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
Data returned
The ID of the created machine.
Example: With required parameters
http://enswitch.example.com/api/json/machines/create/?auth_username=user;auth_password=password;server=example;ipaddr=1.2.3.4{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
Version | Changes |
---|---|
4.1 | type input parameter added. media_audio input parameter added. media_video input parameter added. |
3.14 | weight input parameter added. |
3.13 | Function added. |