View all methods

repoGroups.addRepos

Add repositories to an existing 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.addRepos

Arguments

Name Type Description
token Token Auth token passed as an HTTP header.
repos Array<Object> Array of repository objects to add to the 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"}]
id Number The ID of the repo group. Either id or reference_id must be provided.
reference_id Text The unique reference ID for the repo group. Either id or reference_id must be provided.

Example:
frontend-team

Note: You must provide either id or reference_id to identify the repo group.

Usage info

This endpoint adds repositories to an existing repo group without affecting repositories that are already in the group. If you need to replace all repositories in a group, use repoGroups.upsert instead. Repositories can only belong to one repo group at a time - attempting to add a repository that’s already in another group will return an error.

Example request

This is a typical request:

curl -X POST https://yourinstance.getdx.net/api/repoGroups.addRepos \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
  -H 'Content-Type: application/json' \
  --data '{
  "reference_id": "frontend-team",
  "repos": [
    {
      "source": "github",
      "external_id": "98765"
    },
    {
      "source": "github",
      "external_id": "11111"
    }
  ]
}'

Or by ID:

curl -X POST https://yourinstance.getdx.net/api/repoGroups.addRepos \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
  -H 'Content-Type: application/json' \
  --data '{
  "id": 123,
  "repos": [
    {
      "source": "github",
      "external_id": "98765"
    }
  ]
}'

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"
      },
      {
        "source": "github",
        "external_id": "98765"
      },
      {
        "source": "github",
        "external_id": "11111"
      }
    ]
  }
}