German: "Urlaubsanspruch"
- Attributes
- GET /users/holidays
- GET /users/holidays/{id}
- POST /users/holidays
- PUT /users/holidays/{id}
- DELETE /users/holidays/{id}
Holidays contain among the standard fields also:
- User (creator)
{
"id": 12345,
"year": 2019,
"title": "Urlaubsanspruch 80%",
"days": 20,
"hours": 160,
"user": {
"id": 933590696,
"firstname": "John",
"lastname": "Doe"
},
"created_at": "2018-10-17T09:33:46Z",
"updated_at": "2018-10-17T09:33:46Z"
}
Holiday credits have to be set in days. Holiday days are also converted to hours using the daily hours value that may be set for every user in the holiday section in MOCO: 10 days at 5h/day = 50 hours and 10 days at 8h/day = 80 hours.
Retrieve all holidays:
curl -X GET \
'https://{domain}.mocoapp.com/api/v1/users/holidays?year=2018' \
-H 'Authorization: Token token=YOUR_API_KEY'
This returns an array of all holidays.
The following parameters can be supplied:
- year – 2018
- user_id – 123
Retrieve a single holiday:
curl -X GET \
'https://{domain}.mocoapp.com/api/v1/users/holidays/{id}' \
-H 'Authorization: Token token=YOUR_API_KEY'
Create a holiday:
curl -X POST \
'https://{domain}.mocoapp.com/api/v1/users/holidays' \
-H 'Authorization: Token token=YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"user_id": 933590696,
"year": 2019,
"title": "Urlaubsanspruch 80%",
"days": 20,
}'
Mandatory fields are marked with a star (*):
- year* – 2019
- title* – "Urlaubsanspruch 80%"
- days* – 20
- user_id* – 933590696
Update a holiday.
curl -X PUT \
'https://{domain}.mocoapp.com/api/v1/users/holidays/{id}' \
-H 'Authorization: Token token=YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"days": 22
}'
All fields are analogous to the POST request.
Delete a holiday.
curl -X DELETE \
'https://{domain}.mocoapp.com/api/v1/users/holidays/{id}' \
-H 'Authorization: Token token=YOUR_API_KEY'