Packages
Use the REST API to interact with GitHub Packages.
Sobre o GitHub Packages
Você pode usar a API REST para gerenciar pacotes em seus repositórios e organizações do GitHub. Para obter mais informações, confira "Como restaurar e excluir pacotes".
Para usar a API REST para gerenciar o GitHub Packages, você deve autenticar usando um personal access token (classic).
- Para acessar metadados do pacote, o token precisa incluir o escopo
read:packages. - Para excluir pacotes e versões de pacote, o token precisa incluir os escopos
read:packagesedelete:packages. - Para restaurar pacotes e versões de pacote, o token precisa incluir os escopos
read:packagesewrite:packages.
Se o pacote estiver em um registro que dê suporte a permissões granulares, o token não precisará do escopon do repo para acessar ou gerenciar esse pacote. Se seu pacote estiver em um registro que suporta apenas permissões com escopo de repositório, seu token também deverá incluir o escopo repo, pois seu pacote herda permissões de um repositório GitHub. Para obter uma lista de registros que suportam apenas permissões com escopo de repositório, consulte "Sobre permissões para o GitHub Packages".
Para acessar recursos em uma organização com SSO habilitado, você deve habilitar o SSO para seu personal access token (classic). Para obter mais informações, confira "Como autorizar um personal access token para uso com logon único SAML " na documentação do GitHub Enterprise Cloud.
List packages for an organization
Lists packages in an organization readable by the user.
To use this endpoint, you must authenticate using an access token with the read:packages scope. If the package_type belongs to a registry that only supports repository-scoped permissions, your token must also include the repo scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see "About permissions for GitHub Packages."
Parameters for "List packages for an organization"
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
orgstringRequiredThe organization name. The name is not case sensitive. |
| Query parameters |
| Name, Type, Description |
package_typestringRequiredThe type of supported package. Packages in GitHub's Gradle registry have the type Can be one of: |
visibilitystringThe selected visibility of the packages. This parameter is optional and only filters an existing result set. The Can be one of: |
pageintegerPage number of the results to fetch. Default: |
per_pageintegerThe number of results per page (max 100). Default: |
HTTP response status codes for "List packages for an organization"
| Status code | Description |
|---|---|
200 | OK |
401 | Requires authentication |
403 | Forbidden |
Code samples for "List packages for an organization"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/packages?package_type=containerResponse
Status: 200[
{
"id": 197,
"name": "hello_docker