Bot API
Shifts
9 endpoints. Every address starts with https://api.samplebot.app/v1/servers/{server id}.
GET/shifts/active shifts:read
Who is on shift or on break right now.
curl "https://api.samplebot.app/v1/servers/{server id}/shifts/active" \
-H "Authorization: Bearer $SAMPLE_API_KEY"
Example data:
[
{
"userId": "1246251869798400001",
"kind": "NORMAL",
"onBreak": false,
"onDutyMs": 3720000,
"breakMs": 0
}
]GET/shifts shifts:read
Shifts, newest first. Filter by userId.
| Name | In | Description |
|---|---|---|
userId | query | only this person |
limit | query | 1 to 100 |
curl "https://api.samplebot.app/v1/servers/{server id}/shifts" \
-H "Authorization: Bearer $SAMPLE_API_KEY"
GET/shifts/leaderboard shifts:read
This week's time on duty, most first.
curl "https://api.samplebot.app/v1/servers/{server id}/shifts/leaderboard" \
-H "Authorization: Bearer $SAMPLE_API_KEY"
GET/shifts/users/:userId shifts:read
One person: their open shift and this week's total.
| Name | In | Description |
|---|---|---|
userId required | path |
curl "https://api.samplebot.app/v1/servers/{server id}/shifts/users/{userId}" \
-H "Authorization: Bearer $SAMPLE_API_KEY"
POST/shifts/start shifts:write
Put someone on shift.
| Name | In | Description |
|---|---|---|
userId required | body | Discord user ID |
kind | body | shift type, default NORMAL |
curl -X POST "https://api.samplebot.app/v1/servers/{server id}/shifts/start" \
-H "Authorization: Bearer $SAMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"1246251869798400001"}'
POST/shifts/end shifts:write
End someone's shift.
| Name | In | Description |
|---|---|---|
userId required | body | Discord user ID |
curl -X POST "https://api.samplebot.app/v1/servers/{server id}/shifts/end" \
-H "Authorization: Bearer $SAMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"1246251869798400001"}'
POST/shifts/break/start shifts:write
Put someone on break.
| Name | In | Description |
|---|---|---|
userId required | body |
curl -X POST "https://api.samplebot.app/v1/servers/{server id}/shifts/break/start" \
-H "Authorization: Bearer $SAMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"1246251869798400001"}'
POST/shifts/break/end shifts:write
Bring someone back from break.
| Name | In | Description |
|---|---|---|
userId required | body |
curl -X POST "https://api.samplebot.app/v1/servers/{server id}/shifts/break/end" \
-H "Authorization: Bearer $SAMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"1246251869798400001"}'
POST/shifts/credit shifts:write
Add time to someone's week.
| Name | In | Description |
|---|---|---|
userId required | body | |
minutes required | body | |
note | body |
curl -X POST "https://api.samplebot.app/v1/servers/{server id}/shifts/credit" \
-H "Authorization: Bearer $SAMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"1246251869798400001","minutes":30}'