GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves personal access tokens (PATs) from the GitLab API (v4). It allows filtering and sorting of tokens based on various query parameters such as user ID, token state, creation date, last used date, and more. This is useful for managing and auditing personal access tokens in GitLab, for example, to find active tokens for a specific user or to identify tokens that have not been used recently.

Use Case Examples

  1. Retrieve all active personal access tokens for a specific user by user ID.
  2. Filter tokens created before a certain date to audit old tokens.
  3. Sort tokens by creation date in descending order to see the newest tokens first.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance to which the API requests are sent.
Method The HTTP method used for the API request, default is GET.
Query Parameters Collection of optional filters and pagination parameters to refine the API request for personal access tokens.

Output

JSON

  • tokens
    • id - Unique identifier of the personal access token.
    • name - Name of the personal access token.
    • user_id - User ID associated with the token.
    • revoked - Boolean indicating if the token is revoked.
    • state - State of the token, e.g., active or inactive.
    • created_at - Datetime when the token was created.
    • last_used_at - Datetime when the token was last used.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the GitLab API key credential is correctly configured and has sufficient permissions to access personal access tokens.
  • Verify the base URL is correct for the GitLab instance being queried.
  • Check that query parameters are correctly formatted, especially date-time strings.
  • Common error messages may include authentication failures, invalid query parameters, or permission denied errors. Resolving these typically involves verifying credentials, correcting parameter formats, and ensuring the API user has necessary access rights.

Links

Discussion