JSON API » timegroups » timegroups/periods/create
Creates a new time period.
Input parameters
Requires authentication and the administrator role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| name | String | Name. | Yes | |
| timegroup | Integer | ID of time group to create time period for. | Yes | |
| days_month | String | Days of the month when active, separated by commas. Must be specified as two digits. For example, "01,02" for the first and second days of the month. | No | See below. |
| days_week | String | Days of the week when active, separated by commas. Monday=1, Sunday=7. For example, "1,2,3,4,5" for week days. | No | "1,2,3,4,5,6,7" |
| description | String | Description. | No | Empty string. |
| enddate | Integer | End date in epoch format | No | 0 |
| endhour | Integer | End hour from 0 to 23. | No | 23 |
| endminute | Integer | End minute from 0 to 59. | No | 59 |
| endsecond | Integer | End second from 0 to 59 | No | 59 |
| months | String | Months when active, separated by commas. Must be specified as two digits. For example, "01,02" for January and February. | No | See below. |
| repeats | Integer | 1 to indicate that the period will be repeated, 0 for not | No | 1 |
| startdate | Integer | Start date in epoch format | No | 0 |
| starthour | Integer | Start hour from 0 to 23. | No | 0 |
| startminute | Integer | Start minute from 0 to 59. | No | 0 |
| startsecond | Integer | Start second from 0 to 59. | No | 0 |
| years | String | Years when active, separated by commas. | No | See below. |
| validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
The default for days_month is "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31". The default for months is "01,02,03,04,05,06,07,08,09,10,11,12". The default for years is every year between 2000 and 2099 inclusive, i.e. "2000,2001,2002,...,2098,2099".
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. |
| 403 | Your rate plan does not allow this. |
| 404 | The time group does not exist, or you do not have permission to update it. |
Data returned
The ID of the created time period.
Example: With required parameters
http://enswitch.example.com/api/json/timegroups/periods/create/?auth_username=user;auth_password=password;name=example{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
| Version | Changes |
|---|---|
| 3.15 | repeats, startdate and enddate input parameters added. |
| 3.13 | Function added. |
