Add New Route/Schedule API
Require Authentication
This API is used to add new route/schedule for the company based on combination of deviceID and token.
URL
api/routes/add
Required parameter (POST)
- deviceID
- token
- maintenanceScheduleName «contains route/schedule name»
- startDate «contains timestamp when route/schedule should run. For recurring route/schedule, this will be the first date»
- defaultStartCoordinates_latitude «contains latitude for the first location of route/schedule»
- defaultStartCoordinates_longitude «contains longitude for the first location of route/schedule»
- defaultEndCoordinates_latitude «contains latitude for the first location of route/schedule»
- defaultEndCoordinates_longitude «contains longitude for the first location of route/schedule»
Optional parameter (POST)
- recurringIntervalSeconds «contains interval in seconds for recurring route/schedule. If it is not empty, it will make route/schedule as recurring. If it is empty or not exist, route/schedule will be a not-recurring route/schedule.»
- endDate «contains timestamp when route/schedule should end. Only for recurring route/schedule.»
- defaultStartCoordinates_address1
- defaultStartCoordinates_address2
- defaultStartCoordinates_city
- defaultStartCoordinates_state
- defaultStartCoordinates_country
- defaultStartCoordinates_postcode
- defaultEndCoordinates_address1
- defaultEndCoordinates_address2
- defaultEndCoordinates_city
- defaultEndCoordinates_state
- defaultEndCoordinates_country
- defaultEndCoordinates_postcode
- note
- maxCoveredRadius_meters «contains covered radius in meters from start point to get all bins. If not passed, default value is 5000 meters (5 km).»
- vehicleID «contains vehicleID. If vehicleID is exist, vehicleID value must exist in Get Available Vehicles. Otherwise it will be ignored.»
- avoid «contains array of avoid type. If avoid is exist, avoid value must be tolls, highways, and/or ferries.»
- userID «contains driver userID. If userID is exist, userID value must exist in Get Available Users in Company.»
- projectID «contains array of projectID as a route/schedule parameter. If projectID is exist, projectID value must exist in Get Available Zones.»
- projectgroupID «contains array of projectgroupID as a route/schedule parameter. If projectgroupID is exist, projectgroupID value must exist in Get Available Groups.»
- pinstypesID «contains array of pinstypesID as a route/schedule parameter. If pinstypesID is exist, pinstypesID value must exist in Get Available Asset Types.»
- pinstagsID «contains array of pinstagsID as a route/schedule parameter. If pinstagsID is exist, pinstagsID value must exist in Get Available Tags.»
- projectpinID «contains array of projectpinID that want to be collected in route/schedule, excluding bins calculated from route/schedule parameter. If projectpinID is exist, projectpinID value must exist in Get Available Pins on Map (Specific or All Zone).»
- minimumbinlevel «contains minimum of asset level as route/schedule parameter. If minimumbinlevel is exist, minimumbinlevel value must a number.»
Example JSON Payload
{
"deviceID": "ABCD-EFGH-IJKL-MNOP",
"token": "c43fa596e7916827106b591e2bb026cd",
"maintenanceScheduleID": 1,
"maintenanceScheduleName": "Recurring Schedule",
"startDate": 1473107580,
"endDate": 1473439620,
"defaultStartCoordinates_address1": "Jalan Panjang Alteri Kedoya 19C",
"defaultStartCoordinates_address2": "",
"defaultStartCoordinates_city": "Kota Jakarta Barat",
"defaultStartCoordinates_state": "Daerah Khusus Ibukota Jakarta",
"defaultStartCoordinates_country": "ID",
"defaultStartCoordinates_postcode": "11530",
"defaultStartCoordinates_latitude": -6.202293395996,
"defaultStartCoordinates_longitude": 106.76934051514,
"defaultEndCoordinates_address1": "Jalan Sulaiman 50-67",
"defaultEndCoordinates_address2": "",
"defaultEndCoordinates_city": "Kota Jakarta Barat",
"defaultEndCoordinates_state": "Daerah Khusus Ibukota Jakarta",
"defaultEndCoordinates_country": "ID",
"defaultEndCoordinates_postcode": "11540",
"defaultEndCoordinates_latitude": -6.206111907959,
"defaultEndCoordinates_longitude": 106.77803039551,
"recurringIntervalSeconds": 86400,
"note": "notes",
"maxCoveredRadius_meters": 1000,
"vehicleID": 2,
"drivers": [5],
"avoid": ["tolls","highways"],
"projectID": [1,2],
"projectgroupID": [1],
"pinstypesID": [1, 2],
"pinstagsID": [1, 5],
"projectpinID": [5],
"minimumbinlevel": 80
}
Possible return HTTP status code
- 201
- 400
- 401
- 405
Return message, contains newly created project
{
"status": "success",
"message": {
"maintenanceScheduleID": 4469,
"maintenanceScheduleName": "Sample Schedule",
"startDate": 1473118380,
"endDate": 1473450420,
"defaultStartCoordinates_address1": "Jalan Panjang Alteri Kedoya 19C",
"defaultStartCoordinates_address2": "",
"defaultStartCoordinates_city": "Kota Jakarta Barat",
"defaultStartCoordinates_state": "Daerah Khusus Ibukota Jakarta",
"defaultStartCoordinates_country": "ID",
"defaultStartCoordinates_postcode": "11530",
"defaultStartCoordinates_latitude": -6.202293395996,
"defaultStartCoordinates_longitude": 106.76934051514,
"defaultEndCoordinates_address1": "Jalan Sulaiman 50-67",
"defaultEndCoordinates_address2": "",
"defaultEndCoordinates_city": "Kota Jakarta Barat",
"defaultEndCoordinates_state": "Daerah Khusus Ibukota Jakarta",
"defaultEndCoordinates_country": "ID",
"defaultEndCoordinates_postcode": "11540",
"defaultEndCoordinates_latitude": -6.206111907959,
"defaultEndCoordinates_longitude": 106.77803039551,
"optimized": "Y",
"recurring": "Y",
"recurringIntervalSeconds": 9999,
"note": "notes Sample API",
"maxCoveredRadius_meters": 0,
"createdDate": 1692277299,
"updatedDate": 1692277299,
"createdByUserID": 90,
"updatedByUserID": 90,
"errorMessage": "",
"vehicle": {
"vehicleID": 2,
"vehicleName": "UDMK6",
"vehicleType": "UDMK6",
"vehicleNo": "214435",
"vehicleDescription": "",
"vehicleColor": "",
"vehicleYear": 0
},
"drivers": [],
"avoid": [
"tolls",
"highways"
],
"parameters": {
"projects": [
{
"projectID": 1,
"projectName": "Civic Zone",
"projectAddress1": "",
"projectAddress2": "",
"projectCity": "",
"projectState": "",
"projectCountry": "AU",
"projectZipCode": "",
"projectLatitude": -35.331661224365,
"projectLongitude": 149.16545104981
},
{
"projectID": 2,
"projectName": "Kambah Zone",
"projectAddress1": "",
"projectAddress2": "",
"projectCity": "",
"projectState": "",
"projectCountry": "AU",
"projectZipCode": "",
"projectLatitude": -35.331661224365,
"projectLongitude": 149.16545104981
}
],
"projectgroup": [
{
"projectgroupID": 1,
"projectID": 1,
"groupName": "General Waste"
}
],
"pintypes": [],
"pinstags": [
{
"pinstagsID": 1,
"tags_text": "wheelie bin"
},
{
"pinstagsID": 5,
"tags_text": "240"
}
],
"projectpins": [
{
"projectpinID": 5,
"name": "ACT.01 Wheelie Bin Bowen Park (Near Toilets)",
"serialNumber": "",
"projectID": 1,
"pintypeID": 4,
"customlocationID": 0,
"manufacturerID": 0,
"pinAddress1": "Bowen Park",
"pinAddress2": "",
"pinCity": "Barton",
"pinState": "Australian Capital Territory",
"pinCountry": "AU",
"pinZipCode": "2600",
"latitude": -35.308013916016,
"longitude": 149.13975524902
}
],
"onlypins": [],
"minimumbinlevel": 80
},
"total_execution": 0
}
}