Skip to content

Commit

Permalink
Merge pull request #32 from buildkite/packages/copy-api
Browse files Browse the repository at this point in the history
Documents package copy api
  • Loading branch information
swebb authored Sep 18, 2024
2 parents 9eef3c5 + 86542d8 commit 9938da8
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion pages/apis/rest_api/packages/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Required request form-field content:
</tbody>
</table>

Required scope: `create_packages`
Required scope: `write_packages`

Success response: `200 OK`

Expand Down Expand Up @@ -80,6 +80,50 @@ Required scope: `read_packages`

Success response: `200 OK`

## Copy a package

Copies a package from a source registry to a destination registry.

```bash
curl -H "Authorization: Bearer $TOKEN" \
-X POST "https://api.buildkite.com/v2/packages/organizations/#{org.slug}/registries/#{source_registry.slug}/packages/#{package.id}/copy?to=#{destination_registry.slug}"
-H "Content-Type: application/json"
```

```json
{
"id": "0191e23a-4bc8-7683-bfa4-5f73bc9b7c44",
"url": "https://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry/packages/0191e23a-4bc8-7683-bfa4-5f73bc9b7c44",
"web_url": "https://buildkite.com/organizations/my_great_org/packages/registries/my-registry/packages/0191e23a-4bc8-7683-bfa4-5f73bc9b7c44",
"name": "banana",
"organization": {
"id": "0190e784-eeb7-4ce4-9d2d-87f7aba85433",
"slug": "my_great_org",
"url": "https://api.buildkite.com/v2/organizations/my_great_org",
"web_url": "https://buildkite.com/my_great_org"
},
"registry": {
"id": "0191e238-e0a3-7b0b-bb34-beea0035a39d",
"graphql_id": "UmVnaXN0cnktLS0wMTkxZTIzOC1lMGEzLTdiMGItYmIzNC1iZWVhMDAzNWEzOWQ=",
"slug": "my-registry",
"url": "https://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry",
"web_url": "https://buildkite.com/organizations/my_great_org/packages/registries/my-registry"
}
}
```

Required [query string parameters](/docs/api#query-string-parameters):

<table class="responsive-table">
<tbody>
<tr><th><code>to</code></th><td>Destination registry slug.<br><em>Example:</em> <code>"to=my-registry"</code>.</td></tr>
</tbody>
</table>

Required scopes: `read_packages, write_packages`

Success response: `200 OK`

## Delete a package

```bash
Expand Down

0 comments on commit 9938da8

Please sign in to comment.