Staffbase has introduced new versions for several User API endpoints. These new versions offer improved performance and usability. Staffbase recommends migrating to these new versions to take advantage of the enhancements. The older versions will be deprecated in the future. Learn more about Staffbase API lifecycle.
This article explains:
- The main differences between the old and new versions of the User API endpoints.
- When to use the newly introduced endpoints, which are designed to replace certain legacy behaviors and deliver the same results more efficiently.
This article highlights only the main version differences. It does not include sample requests or responses. For detailed examples or information about each endpoint versions, refer to the User API specification.
Prerequisite:
- You have an understanding of the Staffbase versioning policy.
Create a new user
POST request to /users, with the required Accept and Content-Type headers:
Acceptheader:application/vnd.staffbase.accessors.user.v3+jsonContent-Typeheader:application/vnd.staffbase.accessors.user-invite.v2+json- Changes in request body:
- Required fields:
rolelocale
- System profile field values are only part of the
profileobject - Removed fields (no longer returned in the response):
mandatoryGroupIDsgroupIDstagsinviteMessage
- Restructured fields:
recoveryCodeis now an object - Renamed fields:
externalIDtoexternalIdemails/primarytoemail
- Required fields:
POST request to /users with only the required information and returns the full user object.
Get all users
GET request to /users with required Accept header:
Acceptheader:application/vnd.staffbase.accessors.user.v3+json- Changes in request parameters:
- Use
cursorinstead ofoffsetfor pagination. - Search-related query parameters are not supported. Instead use the
/users/searchendpoint. - Add the
includeProfilequery parameter to retrieve profile data
- Use
- Removed fields (no longer returned in the response):
mandatoryGroupIDsgroupIDstagsinviteMessage- Restructured fields:
recoveryCodeis now an object - Renamed fields:
externalIDtoexternalIdemails/primarytoemail
GET request to /users returns all user information according to the specified query parameters, but relies on the offset-based pagination, which is not performant for large datasets.
Search all users
This is a newly introduced endpoint designed to replace the legacy GET request for returning all users. The search endpoint provides the same results, but more efficiently.
GET request to /users/search with the required Accept header for search capabilities:
Acceptheader:application/vnd.staffbase.accessors.users-search.v1+json- Use
cursorinstead ofoffsetfor pagination. - Add the
includeProfilequery parameter to retrieve profile data - Removed fields (no longer returned in the response):
mandatoryGroupIDsgroupIDstagsinviteMessage
- Restructured fields:
recoveryCodeis now an object - Renamed fields:
externalIDtoexternalIdemails/primarytoemail
GET request to /usersreturns all user information according to the specified query parameters, but relies on the offset-based pagination, which is not performant for large datasets.
Get a user
GET request to /users/{userId} with the required Accept header:
Acceptheader:application/vnd.staffbase.accessors.user.v3+json- Changes in request parameters:
- Add the
includeProfilequery parameter to include profile data
- Add the
- Removed fields (no longer returned in the response):
mandatoryGroupIDsgroupIDstagsinviteMessage
- Restructured fields:
recoveryCodeis now an object - Renamed fields:
externalIDtoexternalIdemails/primarytoemail
- Identifiers:
- Both the Staffbase user ID and your external identifier are supported.
GET request to /users/{userId} with all user information.
Delete a user
DELETE request to /users/{userId} with the required Accept header:
Acceptheader:application/vnd.staffbase.accessors.user-delete.v2+json- Changes in response:
- The returned status code has been updated
- Identifiers:
- Both the Staffbase user ID and your external identifier are supported.
DELETE request to /users/{userId} to delete user async.
Update a user
PATCH request to /users/{userId} with required Accept and Content-Type headers:
Acceptheader:application/vnd.staffbase.accessors.user-update.v3+jsonContent-Typeheader:application/vnd.staffbase.accessors.user.v1+json- Removed fields (no longer returned in the response):
mandatoryGroupIDsgroupIDstagsinviteMessage
- Restructured fields:
recoveryCodeis now an object - Renamed fields:
externalIDtoexternalIdemails/primarytoemail
- Changes in HTTP method:
- Uses
PATCHto more clearly indicate partial updates
- Uses
- Identifiers:
- Both the Staffbase user ID and your external identifier are supported
PUT request to /users/{userId} updates fields in the user object but does not replace the object. This behaviour can be confusing, since PUT is generally used for full replacements and does not align with HTTP semantics.
Retrieve groups for a user
GET request to /users/{userId}/groups/search with required Accept header:
Acceptheader:application/vnd.staffbase.accessors.user.groups-search.v1+json- Changes in request parameters:
- Use
cursorinstead ofoffsetfor pagination - Use the
queryparameter for improved search functionality
- Use
GET request to /users/{userId}/groups retrieves all groups for a user, using offset-based pagination, which is less efficient for large datasets.