0% found this document useful (0 votes)
41 views3 pages

ShiftRota Documentation

To use the shift rota API, you need to: 1. Generate an access token by calling the login endpoint with your credentials. 2. Use the received token to call other endpoints like saving, updating, or getting shift rota data by passing the token in the authorization header. 3. The document provides curl command examples to call each endpoint to save, update, and get shift rota data by passing the required parameters and authorization token.

Uploaded by

sonusmartpoint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

ShiftRota Documentation

To use the shift rota API, you need to: 1. Generate an access token by calling the login endpoint with your credentials. 2. Use the received token to call other endpoints like saving, updating, or getting shift rota data by passing the token in the authorization header. 3. The document provides curl command examples to call each endpoint to save, update, and get shift rota data by passing the required parameters and authorization token.

Uploaded by

sonusmartpoint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

To use shift rota API, you may need to follow below steps:

1. Generate access token using login credentials


2. Get list of endpoints and call them using received token with appropriate methods (GET or
POST)

API Endpoints and purposes:


1. Get login token:
To get login token, you may need to call endpoint with below command:
curl --location '{baseURL}/api/V11/login' \
--form 'email="[email protected]"' \
--form 'password="1234"'

Once you make request using above curl command, you will receive the response
like below:
{
"result": true,
"message": "Successfully Login",
"data": {
"id": 3,
"company_id": 2,
"department_id": 16,
"department_name": "Management",
"is_admin": true,
"is_hr": false,
"is_face_registered": false,
"name": "Admin",
"email": "[email protected]",
"phone": "+880177745",
"avatar": "http://localhost:81/VVR/bymecode/HRM-Regular/public/storage/
public/uploads/user/vMroIMARY6PiUfn16gD3CtIRJNLcK5fXhB2IoGq8.jpg",
"token": "8|7Ud1DoHPlk7JBzF4ji6Y0kij9LWV5OUkGn8tOoPj"
}
}

2. Save shift rota data:


From login request, you’ve received a token. Now, you need to call save shift rota API endpoint
with using received token in previous request (it is using Basic Auth). An example request
command is shared below:

curl --location '{baseURL}/api/V11/shift-roster/add-shift-roster' \


--header 'Authorization: Bearer 8|7Ud1DoHPlk7JBzF4ji6Y0kij9LWV5OUkGn8tOoPj' \
--form 'date="2023-11-26"' \
--form 'user_id="5"' \
--form 'shift_id="4"' \
--form 'workplace_id="1"' \
--form 'remarks="Sample Remarks24"'

In above request, value ‘8|7Ud1DoHPlk7JBzF4ji6Y0kij9LWV5OUkGn8tOoPj’ is the token that


you’ve received from login request.
Once you execute above curl command, you will get a successful result like below if everything
okay.

{
"success": true,
"message": "Data saved successfully",
"data": {
"user_id": "5",
"shift_id": "3",
"workplace_id": "1",
"date": {
"date": "2023-11-30 00:00:00.000000",
"timezone_type": 3,
"timezone": "Asia/Dhaka"
},
"week": "48",
"remarks": "Sample Remarks24",
"updated_at": "2023-11-28T20:11:50.000000Z",
"created_at": "2023-11-28T20:11:50.000000Z",
"id": 30
}
}
**All the parameters are mandatory for this request.

3. Update shift rota data:


Update request is similar as save request. But, you need to specify primary key id here for the
row which you may want to update. An example request command is shared below:

curl --location '{baseURL}/api/V11/shift-roster/update-shift-roster' \


--header 'Authorization: Bearer 7|sMeM3C6F4VG1KJmuBEzjWxdBomQHbafB7vSlsTsn' \
--form 'date="2023-11-30"' \
--form 'user_id="5"' \
--form 'shift_id="3"' \
--form 'workplace_id="1"' \
--form 'remarks="Sample Remarks24"' \
--form 'id="28"'

If everything looks good in request, you will receive the response like below:
{
"success": true,
"message": "Data updated successfully",
"data": {
"id": 28,
"user_id": "5",
"shift_id": "3",
"workplace_id": "1",
"remarks": "Sample Remarks24",
"week": "48",
"date": {
"date": "2023-11-29 00:00:00.000000",
"timezone_type": 3,
"timezone": "Asia/Dhaka"
},
"created_at": "2023-11-26T08:39:48.000000Z",
"updated_at": "2023-11-28T20:13:40.000000Z"
}
}

4. Get Shift Data:


To get shift data, you have to use the below API endpoint (which is a get request):

curl --location --request GET '{baseURL}/api/V11/shift-roster/get-shift-roster?


user_id=5&date=2023-11-30&shift_id=3&week_no=48' \
--header 'Authorization: Bearer 7|sMeM3C6F4VG1KJmuBEzjWxdBomQHbafB7vSlsTsn'

All the parameters are optional here, you may use them to narrow down the results. But, only
user_id is mandatory parameter. You will get JSON response like below if everything is correct
in request:

[
{
"id": 30,
"user_id": 5,
"shift_id": 3,
"workplace_id": 1,
"remarks": "Sample Remarks24",
"week": 48,
"date": "2023-11-30",
"created_at": "2023-11-28T20:11:50.000000Z",
"updated_at": "2023-11-28T20:11:50.000000Z"
}
]

You might also like