Skip to main content
mutation toggleLearningPathBookmark {
  toggleBookmark(bookmarkData: {
    entityId: "42"
    entityType: LEARNING_PATH
  }) {
    errors
    response
  }
}
{
  "data": {
    "toggleBookmark": {
      "errors": [],
      "response": true
    }
  }
}
The 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

mutation toggleBookmark($bookmarkData: BookmarkData!) {
  toggleBookmark(bookmarkData: $bookmarkData) {
    errors
    response
  }
}

Parameters

ParameterTypeDescription
bookmarkDataBookmarkData!The bookmark data containing entity information to toggle

BookmarkData Properties

FieldTypeDescription
entityIdID!The unique identifier of the entity to bookmark (learning path ID or calendar event ID)
entityTypeBookmarkableEntityType!The type of entity being bookmarked. Must be either LEARNING_PATH or EVENT

Response

FieldTypeDescription
errors[Violation]Contains any validation errors or violations encountered during the process
responseBooleanIndicates whether the bookmark toggle operation was successful
mutation toggleLearningPathBookmark {
  toggleBookmark(bookmarkData: {
    entityId: "42"
    entityType: LEARNING_PATH
  }) {
    errors
    response
  }
}
{
  "data": {
    "toggleBookmark": {
      "errors": [],
      "response": true
    }
  }
}
I