gitlab-org--gitlab-foss/doc/api/error_tracking.md

5.1 KiB

stage group info
Monitor Monitor To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments

Error Tracking settings API (FREE)

Introduced in GitLab 12.7.

Error Tracking project settings

The project settings API allows you to retrieve the Error Tracking settings for a project. Only for project maintainers.

Get Error Tracking settings

GET /projects/:id/error_tracking/settings
Attribute Type Required Description
id integer yes The ID or URL-encoded path of the project owned by the authenticated user
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings"

Example response:

{
  "active": true,
  "project_name": "sample sentry project",
  "sentry_external_url": "https://sentry.io/myawesomeproject/project",
  "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
  "integrated": false
}

Enable or disable the Error Tracking project settings

The API allows you to enable or disable the Error Tracking settings for a project. Only for project maintainers.

PATCH /projects/:id/error_tracking/settings
Attribute Type Required Description
id integer yes The ID or URL-encoded path of the project owned by the authenticated user.
active boolean yes Pass true to enable the already configured error tracking settings or false to disable it.
integrated boolean no Pass true to enable the integrated error tracking backend. Available in GitLab 14.2 and later.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true"

Example response:

{
  "active": true,
  "project_name": "sample sentry project",
  "sentry_external_url": "https://sentry.io/myawesomeproject/project",
  "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
  "integrated": false
}

Error Tracking client keys

Introduced in GitLab 14.3.

For integrated error tracking feature. Only for project maintainers.

List project client keys

GET /projects/:id/error_tracking/client_keys
Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"

Example response:

[
  {
    "id": 1,
    "active": true,
    "public_key": "glet_aa77551d849c083f76d0bc545ed053a3",
    "sentry_dsn": "https://glet_aa77551d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
  },
  {
    "id": 3,
    "active": true,
    "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
    "sentry_dsn": "https://glet_0ff98b1d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
  }
]

Create a client key

Creates a new client key for a project. The public key attribute is generated automatically.

POST /projects/:id/error_tracking/client_keys
Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" \
     "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"

Example response:

{
  "id": 3,
  "active": true,
  "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
  "sentry_dsn": "https://glet_0ff98b1d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
}

Delete a client key

Removes a client key from the project.

DELETE /projects/:id/error_tracking/client_keys/:key_id
Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the project owned by the authenticated user.
key_id integer yes The ID of the client key.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys/13"