Points d’accès à l’API REST pour GitHub Marketplace
Utilisez l’API REST pour interagir avec GitHub Marketplace
À propos de la GitHub Marketplace
Pour plus d’informations sur GitHub Marketplace, consultez « GitHub Marketplace ».
Ces points de terminaison vous permettent de voir quels clients utilisent un plan tarifaire, voir les achats d’un client et voir si un compte dispose d’un abonnement actif.
Test avec des points de terminaison nommés
Vous pouvez tester votre GitHub App avec des données stubbées. Les données nommées sont codées en dur ; ce sont de fausses données qui ne changeront pas en fonction des abonnements réels.
Pour tester avec des données nommées, utilisez un point de terminaison appelé à la place de son équivalent de production. Cela vous permet de tester si la logique d’API réussit avant de répertorier des GitHub Apps sur GitHub Marketplace.
Veillez à remplacer les points de terminaison appelés par des points de terminaison de production avant de déployer votre GitHub App.
Get a subscription plan for an account
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « Get a subscription plan for an account »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Get a subscription plan for an account »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
account_id integer Obligatoireaccount_id parameter |
Codes d’état de la réponse HTTP pour « Get a subscription plan for an account »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
Exemples de code pour « Get a subscription plan for an account »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/accounts/ACCOUNT_ID
Response
Status: 200
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
List plans
Lists all plans that are part of your GitHub Enterprise Cloud Marketplace listing.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « List plans »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « List plans »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List plans »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
Exemples de code pour « List plans »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/plans
Response
Status: 200
[
{
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
]
List accounts for a plan
Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « List accounts for a plan »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « List accounts for a plan »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
plan_id integer ObligatoireThe unique identifier of the plan. |
Nom, Type, Description |
---|
sort string The property to sort the results by. Default: Peut être: |
direction string To return the oldest accounts first, set to Peut être: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List accounts for a plan »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « List accounts for a plan »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/plans/PLAN_ID/accounts
Response
Status: 200
[
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
]
Get a subscription plan for an account (stubbed)
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « Get a subscription plan for an account (stubbed) »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Get a subscription plan for an account (stubbed) »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
account_id integer Obligatoireaccount_id parameter |
Codes d’état de la réponse HTTP pour « Get a subscription plan for an account (stubbed) »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
404 | Not Found when the account has not purchased the listing |
Exemples de code pour « Get a subscription plan for an account (stubbed) »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/stubbed/accounts/ACCOUNT_ID
Response
Status: 200
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
List plans (stubbed)
Lists all plans that are part of your GitHub Enterprise Cloud Marketplace listing.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « List plans (stubbed) »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « List plans (stubbed) »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List plans (stubbed) »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
Exemples de code pour « List plans (stubbed) »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/stubbed/plans
Response
Status: 200
[
{
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
]
List accounts for a plan (stubbed)
Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth apps must use basic authentication with their client ID and client secret to access this endpoint.
Jetons d’accès affinés pour « List accounts for a plan (stubbed) »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « List accounts for a plan (stubbed) »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
plan_id integer ObligatoireThe unique identifier of the plan. |
Nom, Type, Description |
---|
sort string The property to sort the results by. Default: Peut être: |
direction string To return the oldest accounts first, set to Peut être: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List accounts for a plan (stubbed) »
Code d’état | Description |
---|---|
200 | OK |
401 | Requires authentication |
Exemples de code pour « List accounts for a plan (stubbed) »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/marketplace_listing/stubbed/plans/PLAN_ID/accounts
Response
Status: 200
[
{
"url": "https://api.github.com/orgs/github",
"type": "Organization",
"id": 4,
"login": "github",
"organization_billing_email": "billing@github.com",
"marketplace_pending_change": {
"effective_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"id": 77,
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1111",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1111/accounts",
"id": 1111,
"number": 2,
"name": "Startup",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 699,
"yearly_price_in_cents": 7870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"state": "published",
"unit_name": null,
"bullets": [
"Up to 10 private repositories",
"3 concurrent builds"
]
}
},
"marketplace_purchase": {
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
}
]
List subscriptions for the authenticated user
Lists the active subscriptions for the authenticated user.
Jetons d’accès affinés pour « List subscriptions for the authenticated user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis ne nécessite aucune autorisation.
Paramètres pour « List subscriptions for the authenticated user »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List subscriptions for the authenticated user »
Code d’état | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
404 | Resource not found |
Exemples de code pour « List subscriptions for the authenticated user »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/user/marketplace_purchases
Response
Status: 200
[
{
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"account": {
"login": "github",
"id": 4,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"email": null,
"organization_billing_email": "billing@github.com",
"type": "Organization"
},
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
]
List subscriptions for the authenticated user (stubbed)
Lists the active subscriptions for the authenticated user.
Jetons d’accès affinés pour « List subscriptions for the authenticated user (stubbed) »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis ne nécessite aucune autorisation.
Paramètres pour « List subscriptions for the authenticated user (stubbed) »
Nom, Type, Description |
---|
accept string Setting to |
Nom, Type, Description |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List subscriptions for the authenticated user (stubbed) »
Code d’état | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
Exemples de code pour « List subscriptions for the authenticated user (stubbed) »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com
par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com
.
Exemple de requête
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/user/marketplace_purchases/stubbed
Response
Status: 200
[
{
"billing_cycle": "monthly",
"next_billing_date": "2017-11-11T00:00:00Z",
"unit_count": null,
"on_free_trial": true,
"free_trial_ends_on": "2017-11-11T00:00:00Z",
"updated_at": "2017-11-02T01:12:12Z",
"account": {
"login": "github",
"id": 4,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"email": null,
"organization_billing_email": "billing@github.com",
"type": "Organization"
},
"plan": {
"url": "https://api.github.com/marketplace_listing/plans/1313",
"accounts_url": "https://api.github.com/marketplace_listing/plans/1313/accounts",
"id": 1313,
"number": 3,
"name": "Pro",
"description": "A professional-grade CI solution",
"monthly_price_in_cents": 1099,
"yearly_price_in_cents": 11870,
"price_model": "FLAT_RATE",
"has_free_trial": true,
"unit_name": null,
"state": "published",
"bullets": [
"Up to 25 private repositories",
"11 concurrent builds"
]
}
}
]