toggleBookmark
mutation provides a convenient way to manage user bookmarks. It automatically creates a bookmark if one doesn’t exist, or removes it if it already exists, making it perfect for bookmark toggle buttons in user interfaces.
How It Works
1
Check existing bookmark
The API checks if a bookmark already exists for the specified entity and current user.
2
Toggle bookmark state
- If bookmark does not exist: Creates a new bookmark
- If bookmark exists: Removes the existing bookmark
3
Return success response
Returns a success response indicating the operation completed successfully.
GraphQL Mutation
Parameters
Parameter | Type | Description |
---|---|---|
bookmarkData | BookmarkData! | The bookmark data containing entity information to toggle |
BookmarkData Properties
Field | Type | Description |
---|---|---|
entityId | ID! | The unique identifier of the entity to bookmark (learning path ID or calendar event ID) |
entityType | BookmarkableEntityType! | The type of entity being bookmarked. Must be either LEARNING_PATH or EVENT |
Response
Field | Type | Description |
---|---|---|
errors | [Violation] | Contains any validation errors or violations encountered during the process |
response | Boolean | Indicates whether the bookmark toggle operation was successful |