From dd0cb89fff1cf4641c25dd3a53e33cb7f2c65159 Mon Sep 17 00:00:00 2001 From: Elizabeth Vo <65384387+ensvo@users.noreply.github.com> Date: Thu, 12 Sep 2024 03:26:35 +0900 Subject: [PATCH] api docs for package create --- pages/apis/rest_api/packages/packages.md | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/pages/apis/rest_api/packages/packages.md b/pages/apis/rest_api/packages/packages.md index 49bf31cbd9..d84bebfcdc 100644 --- a/pages/apis/rest_api/packages/packages.md +++ b/pages/apis/rest_api/packages/packages.md @@ -2,6 +2,49 @@ The packages tokens API lets you create and manage packages in a registry. +## Upload a package + +```bash +curl -H "Authorization: Bearer $TOKEN" \ + -X POST "https://api.buildkite.com/v2/packages/organizations/#{org.slug}/registries/#{registry.slug}/packages" \ + -H "Content-Type: application/json" \ + -F 'file=@path/to/ruby/gem/banana-1.0.0.gem' +``` + +```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 request form-field content: + + + + + +
filePath to the package.
Example: "file=@path/to/ruby/gem/banana-1.0.0.gem".
+ +Required scope: `create_packages` + +Success response: `200 OK` + ## Get a package Returns the details for a single package.