To access the API, go to Admin > Widgets & API. All endpoints are listed under the Endpoints 1.0 tab of the Widgets & API page.
What is an API?
API stands for Application Programming Interface and it allows you to display and process your LibStaffer content outside of your system. The LibStaffer API offers more flexibility than widgets, but it also requires more extensive coding knowledge and is more complicated than just copying and pasting some embed code.
To think of this in another way, widgets are kind of like a frozen dinner - what you see is what you get. APIs are like individual ingredients. Think of all the different meals a cook can create from the same set of ingredients! APIs offer you the same opportunity to mix & match. The possibilities are almost endless!
API v1.0 endpoints
The v1.0 endpoints include requests that allow you to get data from your system. In order to request data from the API, you must first set up an application in LibStaffer. This will provide you with a unique Client ID and Client Secret, which you will need in order to obtain an access token. A valid token is required for LibStaffer to return data to your app. If you do not include an access token, or the token is expired, an error message will be returned.
Your existing applications will be displayed under the API Authorization tab. If you need to create a new one:
- Under the API Authorization tab, click on the Create New Application button.
- In the Create Application modal window, give your application a name. This is only used to help you organize your applications, so you know which ID/Secret pairs you're using with your different apps.
- Optionally, you can add a Description to provide more info about how you're using this application.
- For the Scope, select the checkbox for each module you want this application to have access to.
- Available Hours - Read: this will give the application read-only access to each user's available working hours.
- Users - Read: this will give the application read-only access to user-specific information, including their name, email address, assigned shifts, and time off.
- Schedules - Read: this will give the application read-only access to schedule information, including schedule names, account IDs for assigned staff, friendly URLs, and shifts.
- Click the Create button to save your changes.
- Your Client ID and Client Secret will appear in the Applications table.
- To obtain an access token, use the
/api/1.0/oauth/tokenendpoint for your site's API. You'll find this information in the Obtaining an Access Token box on the API Authorization page.
- The LibStaffer v1.0 API uses oAuth 2.0 for authentication and supports the Client Credentials grant type.
- When submitting your API request, you'll need to provide that token in the
Authorizationheader. You can find an example for your site in the Authorizing your API Requests box on the API Authorization page.
Full details for using each endpoint are available in LibStaffer under the Endpoints 1.0 tab -- just click on the endpoint's URL on that page to view its specific documentation and example requests.
Below is a summary of what you can do with the available endpoints.
- Available Hours: the
/available_hoursendpoint allows you to get the available working hours for all users in your system but can be used to retrieve hours for a single user ID, as well.
- Schedules: the
/schedulesendpoint allows you to get information about your schedules, such as schedule names and assigned user IDs. The
/schedules/shiftsendpoint allows you to get a schedule's shifts up to 90 days in the future.
- Users: the
/usersendpoint allows you to get information about your users, including their names and email addresses. The
/users/shiftsendpoint allows you to get an individual user's assigned shifts, while
/users/timeoffendpoint does the same for time off requests.