How Can We Help?
API Documentation
The eSchedule API allows organizations the ability to connect to our RESTful service. If authenticated, HTTP GET requests can be made. The endpoints return a JSON object containing eSchedule information.
Please contact our Support Team to obtain your token.
Function: read
This endpoint returns a JSON object containing schedule/shift data, depending on the date range provided in the request. By default, if no parameters are provided, the data returned will be ALL of today/tomorrows shifts. A max date range of 30 days is allowed. Currently the only view other than all is ‘Prime Shifts’.
If connected properly, the shift data will be returned with a root of ‘Shifts’, and a root of ‘Error’ if there’s an issue.
URL: https://yourAgency.myesched.com/eschedule_api/product/read.php?
Headers
token | your_token (contact support to get this) |
Params
start_time | 9/10/2018 |
end_time | 9/16/2018 |
view | prime_shifts |
The shift data will be key-valued pairs formatted as so:
{
“first_name”: “John”,
“last_name”: “Doe”,
“shift_date”: “09/10/2018”,
“shift_index”: “10”,
“position_index”: “1”,
“shift_name”: “Day Float 1”,
“position”: “Officer”,
“emt_level_code”: “P”,
“observer”: null,
“start_time”: “2018-09-10T10:00Z”,
“end_time”: “2018-09-10T22:00Z”,
“shift_notes”: “Sample Notes”
}
Note: Returned datetimes are returned in TZ format (UTC), while the shift_date will be returned as the agencies local time
Example Code
Language cURL
curl –request GET \
–url ‘https://yourDomain.myesched.com/eschedule_api/product/read.php?start_time=9/10/2018&end_time=9/16/2018’ \
–header ‘token: some_value’
—————————————————————————————————————————————-
Language jQuery
var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://yourAgency.myesched.com/eschedule_api/product/read.php?start_time=9/10/2018&end_time=9/16/2018”,
“method”: “GET”,
“headers”: {
“token”: “some_value”
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
—————————————————————————————————————————————-
Language Python
import requests
url = “https://yourDomain.myesched.com/eschedule_api/product/read.php”
querystring = {“start_time”:”9/10/2018″,”end_time”:”9/16/2018″}
headers = {‘token’: ‘some_value’}
response = requests.request(“GET”, url, headers=headers, params=querystring)
print(response.text)
Language Node
var http = require(“https”);
var options = {
“method”: “GET”,
“hostname”: [
“yourDomain”,
“myesched”,
“com”
],
“path”: [
“eschedule_api”,
“product”,
“read.php”
],
“headers”: {
“token”: “some_value”
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on(“data”, function (chunk) {
chunks.push(chunk);
});
res.on(“end”, function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
Function: clockin
This function returns a JSON object containing either a ‘success’ or ‘error’ array. Parameters vary based on when/what the user is clocking in for. Token and User_id are always required.
URL: https://yourAgency.myesched.com/eschedule_api/product/clockin/index.php?
Headers
token | your_token (contact support to get this) |
Params
User_id | User.name |
Comments Required if clocking in to scheduled shift outside of grace period, and for All Activities | “Clocking in” |
time_clock_activities_id Required if not scheduled. Must be from valid Time Clock Activity | “19” |
Other_activity Comment for Other Activity – Required if Activity=Other | “Off-duty response” |
Successful Clockin returns:
{“success”:”user.id has been clocked in”}
Error codes
Error 100 – Invalid User ID or Ambulance ID
Error 101 – Invalid User ID
Error 200 – Invalid activities ID – Also returns array of valid time_clock_activities_id (See below)
Error 201 – Other Activity Description Required
Error 202 – Not on schedule, Returns valid time clock activities ids – – Also returns array of valid time_clock_activities_id
Example json:
{“tca”: [
{
“time_clock_activities_id”: “5”,
“description”: “Other”
},
{
“time_clock_activities_id”: “2”,
“description”: “Training”
}
],
“error”: {
“code”: “202”,
“message”: “Not on schedule, time clock activity required”
}
}
Output – Error 300 – Clockin for Activity – Comments Required
Output – Error 301 – In Early – Comments Required
Output – Error 302 – In Late – Comments Required
Output – Error 401 – User already clocked in
Ex JSON for errors: {“error”:{“code”:”301″,”message”:” In early or in late – Comments Required “}}
Function: clockout
This function returns a JSON object containing either a ‘success’ or ‘error’ array. Token and User_id are always required. Comments are required if clocking out of scheduled shift outside of grace period
URL: https://yourAgency.myesched.com/eschedule_api/product/clockout/index.php?
Headers
token | your_token (contact support to get this) |
Params
User_id | User.name |
Comments Required if clocking out of scheduled shift outside of grace period | “Clocking out” |
Successful Clockout returns:
Json: {“success”:”user.id has been clocked out”}
Error codes
Error 100 – Invalid User ID or Ambulance ID
Error 101 – Invalid User ID
Error 303 – Out early – Comments Required
Error 304 – Out late – Comments Required
Json: {“error”:{“code”:”304″,”message”: “Out Late – Comments Required “}}
Output – Error 400 – User is not clocked in
Json: {“error”:{“code”:”302″,”message”: “User is not clocked in”}}
Function: onShift
This function returns a JSON array of all people currently on shift
URL: https://yourAgency.myesched.com/eschedule_api/product/onshift/index.php?
Headers
Token your_token
Output
