Skip to main content
The REST API is now versioned. For more information, see "About API versioning."

Paquets

Utilisez l’API REST pour interagir avec GitHub Packages.

À propos de GitHub Packages

Vous pouvez utiliser l’API REST pour gérer les packages dans vos dépôts et organisations GitHub. Pour plus d’informations, consultez « Restauration et suppression des packages ».

Pour utiliser l’API REST afin de gérer GitHub Packages, vous devez vous authentifier avec un personal access token (classic).

  • Pour accéder aux métadonnées de package, votre jeton doit avoir l’étendue read:packages.
  • Pour supprimer des packages et des versions de package, votre jeton doit avoir les étendues read:packages et delete:packages.
  • Pour restaurer des packages et des versions de package, votre jeton doit avoir les étendues read:packages et write:packages.

Si votre package se trouve dans un registre qui prend en charge les autorisations granulaires, votre jeton n’a pas besoin de l’étendue repo pour accéder ou gérer ce package. Si votre package se trouve dans un registre qui prend en charge uniquement les autorisations limitées au dépôt, votre jeton doit aussi inclure l’étendue repo dans la mesure où votre package hérite des autorisations d’un dépôt GitHub. Pour obtenir la liste des registres qui prennent en charge uniquement les autorisations limitées au dépôt, consultez « À propos des autorisations pour GitHub Packages ».

Pour accéder aux ressources d’une organisation avec l’authentification unique activée, vous devez activer l’authentification unique pour votre personal access token (classic). Pour plus d’informations, consultez « Autorisation de l’utilisation d’un personal access token avec l’authentification unique SAML » dans la documentation de GitHub Enterprise Cloud.

List packages for an organization

Lists all packages in an organization readable by the user.

To use this endpoint, you must authenticate using an access token with the packages:read 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."

Paramètres

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
orgstringRequired

The organization name. The name is not case sensitive.

Query parameters
Name, Type, Description
package_typestringRequired

The type of supported package. Packages in GitHub's Gradle registry have the type maven. Docker images pushed to GitHub's Container registry (ghcr.io) have the type container. You can use the type docker to find images that were pushed to GitHub's Docker registry (docker.pkg.github.com), even if these have now been migrated to the Container registry.

Can be one of: npm, maven, rubygems, docker, nuget, container

visibilitystring

The selected visibility of the packages. This parameter is optional and only filters an existing result set.

The internal visibility is only supported for GitHub Packages registries that allow for granular permissions. For other ecosystems internal is synonymous with private. For the list of GitHub Packages registries that support granular permissions, see "About permissions for GitHub Packages."

Can be one of: public, private, internal

Codes de statut de réponse HTTP

Code d’étatDescription
200

OK

401

Requires authentication

403

Forbidden

Exemples de code

get/orgs/{org}/packages
curl \ -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=container

Response

Status: 200
[ { "id": 197, "name": "hello_docker", "package_type": "container", "owner": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github", "html_url": "https://github.com/github", "followers_url": "https://api.github.com/users/github/followers", "following_url": "https://api.github.com/users/github/following{