JSON API » timegroups » timegroups/periods/create

Creates a new time period.

Input parameters

Requires authentication and the administrator role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
nameStringName.Yes
timegroupIntegerID of time group to create time period for.Yes
days_monthStringDays 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.NoSee below.
days_weekStringDays 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"
descriptionStringDescription.NoEmpty string.
enddateIntegerEnd date in epoch formatNo0
endhourIntegerEnd hour from 0 to 23.No23
endminuteIntegerEnd minute from 0 to 59.No59
endsecondIntegerEnd second from 0 to 59No59
monthsStringMonths when active, separated by commas. Must be specified as two digits. For example, "01,02" for January and February.NoSee below.
repeatsInteger1 to indicate that the period will be repeated, 0 for notNo1
startdateIntegerStart date in epoch formatNo0
starthourIntegerStart hour from 0 to 23.No0
startminuteIntegerStart minute from 0 to 59.No0
startsecondIntegerStart second from 0 to 59.No0
yearsStringYears when active, separated by commas.NoSee below.
validationInteger1 to validate input then return, 0 for full action.No0

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

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your rate plan does not allow this.
404The 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

VersionChanges
3.15repeats, startdate and enddate input parameters added.
3.13Function added.