GitLab API

GitlabTool

Actions1000

Overview

This node operation allows creating a new SSH key for a specific user in GitLab by making a POST request to the GitLab API endpoint `/api/v4/users/{user_id}/keys`. It is useful for automating the management of user SSH keys in GitLab, such as adding new keys for user access programmatically.

Use Case Examples

  1. Automatically add an SSH key to a user's GitLab account when onboarding a new developer.
  2. Manage SSH keys for multiple users in GitLab through an automated workflow.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for testing or public endpoints.
Authentication Specifies the authentication method to use, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters to be included in the request path, specifically the user_id to identify the user for whom the SSH key is being created.

Output

JSON

  • id - The ID of the created SSH key.
  • title - The title of the SSH key.
  • key - The SSH public key content.
  • created_at - Timestamp when the SSH key was created.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the user_id path parameter is correctly provided and corresponds to an existing user in GitLab.
  • Verify that the API key used for authentication has sufficient permissions to create SSH keys for users.
  • Check the baseUrl is correctly set to the GitLab instance URL if using a self-hosted GitLab.
  • Common error messages include 401 Unauthorized (authentication failure), 404 Not Found (user not found), and 400 Bad Request (invalid key data). Resolving these involves verifying credentials, user existence, and request body format respectively.

Links

Discussion