GitLab API icon

GitLab API

Gitlab

Actions1062

Snippets → postApiV4Snippets

AI-generated

Summary

Posts a new snippet to GitLab via the /api/v4/snippets endpoint. Uses the gitlabApi credential unless skipAuthentication is set to true, appends the path to the instance's base URL (default https://gitlab.com), and sends the request body defined by the node's OpenAPI postApiV4Snippets schema. The HTTP method can be overridden via the Method field (defaults to GET but the operation is intended for POST). The operation returns the parsed JSON response from GitLab.

Inputs

  • skipAuthentication — When true, the request is sent without authenticating using the gitlabApi credential.
  • authentication (required) — Internal reference to the gitlabApi credential; hidden in the UI.
  • baseUrl — Base URL of the GitLab instance; defaults to https://gitlab.com.
  • method — HTTP method to use (GET, POST, PUT, DELETE, HEAD, PATCH); default is GET.
  • body (required) — Request body conforming to the postApiV4Snippets schema defined in the node's OpenAPI specification.

Output shape

object

Contains the JSON response returned by the GitLab API for the snippet creation request.

Examples

Example 1: Create a snippet

skipAuthentication=false, baseUrl=https://gitlab.com, method=POST, body={title: 'Test snippet', file_name: 'test.txt', code: 'print("Hello"')

Links

Discussion