Requires any of the roles: | SystemAdministrator, Manager, Customer |
POST | /customers/{customerId}/test-schedule | ||
---|---|---|---|
POST | /endpoints/{endpointId}/test-schedule |
import java.math.*
import java.util.*
import net.servicestack.client.*
/**
* Test the customer's schedule
*/
@Api(Description="Test the customer's schedule")
open class TestSchedule
{
/**
* The ID of the customer whose schedule you want to test
*/
@ApiMember(Description="The ID of the customer whose schedule you want to test")
var customerId:String? = null
/**
* The ID of the endpoint whose schedule you want to test.
*/
@ApiMember(Description="The ID of the endpoint whose schedule you want to test.")
var endpointId:String? = null
/**
* The schedule to use (leave null to use the current saved schedule)
*/
@ApiMember(Description="The schedule to use (leave null to use the current saved schedule)")
var schedule:Schedule? = null
/**
* The ISO string of the date and time you want to test
*/
@ApiMember(Description="The ISO string of the date and time you want to test")
var dateTime:String? = null
}
open class Schedule
{
var timeZoneId:String? = null
var inherit:Boolean? = null
var forceClosed:Boolean? = null
var rules:ArrayList<SchedulingRule> = ArrayList<SchedulingRule>()
var defaultState:String? = null
}
open class SchedulingRule
{
var id:String? = null
var name:String? = null
var priority:Int? = null
var state:String? = null
var source:String? = null
var condition:String? = null
var simpleRuleType:SimpleSchedulingRuleTypes? = null
var customerState:String? = null
var flowId:String? = null
var flowParams:Struct? = null
var isAllDay:Boolean? = null
var startDate:String? = null
var startTime:String? = null
var endTime:String? = null
var bySetPosition:ArrayList<Int> = ArrayList<Int>()
var byMonth:ArrayList<Int> = ArrayList<Int>()
var byWeekNo:ArrayList<Int> = ArrayList<Int>()
var byYearDay:ArrayList<Int> = ArrayList<Int>()
var byMonthDay:ArrayList<Int> = ArrayList<Int>()
var byDay:ArrayList<ScheduleDay> = ArrayList<ScheduleDay>()
var byHour:ArrayList<Int> = ArrayList<Int>()
var byMinute:ArrayList<Int> = ArrayList<Int>()
var interval:Int? = null
var count:Int? = null
var untilDate:String? = null
var frequency:SchedulingRuleFrequency? = null
}
enum class SimpleSchedulingRuleTypes
{
Always,
CustomerState,
Time,
}
open class Struct : HashMap<String,Value>()
{
}
open class Value
{
var boolValue:Boolean? = null
var stringValue:String? = null
var numberValue:Double? = null
var listValue:ArrayList<Struct> = ArrayList<Struct>()
var structValue:Struct? = null
}
open class ScheduleDay
{
var offset:Int? = null
var dayOfWeek:DayOfWeek? = null
}
enum class SchedulingRuleFrequency
{
None,
Secondly,
Minutely,
Hourly,
Daily,
Weekly,
Monthly,
Yearly,
}
open class TestScheduleResponse
{
var stateName:String? = null
var timeZoneId:String? = null
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /customers/{customerId}/test-schedule HTTP/1.1
Host: evovoice.io
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
customerId: String,
endpointId: String,
schedule:
{
timeZoneId: String,
inherit: False,
forceClosed: False,
rules:
[
{
id: String,
name: String,
priority: 0,
state: String,
source: String,
condition: String,
simpleRuleType: Always,
customerState: String,
flowId: String,
flowParams:
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
null
]
}
}
],
structValue:
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
null
]
}
}
}
}
],
structValue:
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
null
]
}
}
],
structValue:
{
String:
{
boolValue: False,
stringValue: String,
numberValue: 0,
listValue:
[
null
]
}
}
}
}
}
},
isAllDay: False,
startDate: String,
startTime: String,
endTime: String,
bySetPosition:
[
0
],
byMonth:
[
0
],
byWeekNo:
[
0
],
byYearDay:
[
0
],
byMonthDay:
[
0
],
byDay:
[
{
offset: 0,
dayOfWeek: Sunday
}
],
byHour:
[
0
],
byMinute:
[
0
],
interval: 0,
count: 0,
untilDate: String,
frequency: None
}
],
defaultState: String
},
dateTime: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { stateName: String, timeZoneId: String }