View all methods

repoGroups.upsert

Create or update a repo group.

The repoGroups API endpoints need to be manually enabled on your DX account. Reach out to your DX account manager to get started.

Facts

Method POST https://yourinstance.getdx.net/api/repoGroups.upsert

Arguments

Required arguments

Name Type Description
token Token Auth token passed as an HTTP header.
name Text The name of the repo group.

Example:
Frontend Team

Optional arguments

Name Type Description
id Number The ID of an existing repo group to update. If provided, will update the existing group.
reference_id Text A unique identifier for the repo group to support idempotent updates.

Example:
frontend-team
parent_id Number The ID of the parent repo group, if the new repo group is intended to be a child node in the hierarchy.

Example:
456
repos Array<Object> Array of repository objects to associate with this group. Each object should contain source and external_id.

external_id is the repo id assigned by the source. For example, if the source is github, the external_id should be the id assigned by Github. source and external_id can be retrieved with a query of the repos table on the Data Studio page of the DX dashboard.

Example:
[{"source": "github", "external_id": "12345"}]

Example request

This is a typical request:

curl -X POST https://yourinstance.getdx.net/api/repoGroups.upsert \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
  -H 'Content-Type: application/json' \
  --data '{
  "reference_id": "frontend-team",
  "name": "Frontend Team",
  "parent_id": 456,
  "repos": [
    {
      "source": "github",
      "external_id": "12345"
    },
    {
      "source": "github",
      "external_id": "67890"
    }
  ]
}'

Example response

{
  "ok": true,
  "data": {
    "id": 123,
    "reference_id": "frontend-team",
    "name": "Frontend Team",
    "parent_id": 456,
    "row_created_at": "2024-01-01T10:00:00Z",
    "row_updated_at": "2024-01-01T10:00:00Z",
    "repos": [
      {
        "source": "github",
        "external_id": "12345"
      },
      {
        "source": "github",
        "external_id": "67890"
      }
    ]
  }
}