Skip to main content
REST API теперь версия. Дополнительные сведения см. в разделе "О управлении версиями API".

Конечные точки REST API для GitHub Marketplace

Использование REST API для взаимодействия с GitHub Marketplace

О GitHub Marketplace

Дополнительные сведения о GitHub Marketplaceсм. в разделе "GitHub Marketplace".

Эти конечные точки позволяют узнать, какие клиенты используют тарифный план, просмотреть покупки клиента и узнать, есть ли у учетной записи активная подписка.

Тестирование с использованием суррогатных конечных точек

Вы можете протестировать данные GitHub App с помощью ступеных данных. Cуррогатные данные — это жестко закодированные, выдуманные данные, которые не изменяются в зависимости от фактических подписок.

Для тестирования с использованием суррогатных данных используйте суррогатную конечную точку вместо ее рабочего аналога. Это позволяет проверить успешность логики API перед перечислением GitHub Apps на GitHub Marketplace.

Перед развертыванием 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.

Подробные маркеры доступа для "Get a subscription plan for an account

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Get a subscription plan for an account"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
account_id integer Обязательное поле

account_id parameter

Коды состояния http-ответа для "Get a subscription plan for an account"

Код состоянияОписание
200

OK

401

Requires authentication

404

Not Found when the account has not purchased the listing

Примеры кода для "Get a subscription plan for an account"

Пример запроса

get/marketplace_listing/accounts/{account_id}
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 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.

Подробные маркеры доступа для "List plans

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "List plans"

Заголовки
Имя., Тип, Description
accept string

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

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List plans"

Код состоянияОписание
200

OK

401

Requires authentication

404

Resource not found

Примеры кода для "List plans"

Пример запроса

get/marketplace_listing/plans
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.

Подробные маркеры доступа для "List accounts for a plan

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "List accounts for a plan"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
plan_id integer Обязательное поле

The unique identifier of the plan.

Параметры запроса
Имя., Тип, Description
sort string

The property to sort the results by.

По умолчанию.: created

Возможные значения: created, updated

direction string

To return the oldest accounts first, set to asc. Ignored without the sort parameter.

Возможные значения: asc, desc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List accounts for a plan"

Код состоянияОписание
200

OK

401

Requires authentication

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Примеры кода для "List accounts for a plan"

Пример запроса

get/marketplace_listing/plans/{plan_id}/accounts
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.

Подробные маркеры доступа для "Get a subscription plan for an account (stubbed)

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Get a subscription plan for an account (stubbed)"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
account_id integer Обязательное поле

account_id parameter

Коды состояния http-ответа для "Get a subscription plan for an account (stubbed)"

Код состоянияОписание
200

OK

401

Requires authentication

404

Not Found when the account has not purchased the listing

Примеры кода для "Get a subscription plan for an account (stubbed)"

Пример запроса

get/marketplace_listing/stubbed/accounts/{account_id}
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 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.

Подробные маркеры доступа для "List plans (stubbed)

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "List plans (stubbed)"

Заголовки
Имя., Тип, Description
accept string

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

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List plans (stubbed)"

Код состоянияОписание
200

OK

401

Requires authentication

Примеры кода для "List plans (stubbed)"

Пример запроса

get/marketplace_listing/stubbed/plans
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.

Подробные маркеры доступа для "List accounts for a plan (stubbed)

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "List accounts for a plan (stubbed)"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
plan_id integer Обязательное поле

The unique identifier of the plan.

Параметры запроса
Имя., Тип, Description
sort string

The property to sort the results by.

По умолчанию.: created

Возможные значения: created, updated

direction string

To return the oldest accounts first, set to asc. Ignored without the sort parameter.

Возможные значения: asc, desc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List accounts for a plan (stubbed)"

Код состоянияОписание
200

OK

401

Requires authentication

Примеры кода для "List accounts for a plan (stubbed)"

Пример запроса

get/marketplace_listing/stubbed/plans/{plan_id}/accounts
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.

Подробные маркеры доступа для "List subscriptions for the authenticated user

Эта конечная точка работает со следующими точными типами маркеров:

Для тонкого маркера не требуются разрешения.

Параметры для "List subscriptions for the authenticated user"

Заголовки
Имя., Тип, Description
accept string

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

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List subscriptions for the authenticated user"

Код состоянияОписание
200

OK

304

Not modified

401

Requires authentication

404

Resource not found

Примеры кода для "List subscriptions for the authenticated user"

Пример запроса

get/user/marketplace_purchases
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.

Подробные маркеры доступа для "List subscriptions for the authenticated user (stubbed)

Эта конечная точка работает со следующими точными типами маркеров:

Для тонкого маркера не требуются разрешения.

Параметры для "List subscriptions for the authenticated user (stubbed)"

Заголовки
Имя., Тип, Description
accept string

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

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List subscriptions for the authenticated user (stubbed)"

Код состоянияОписание
200

OK

304

Not modified

401

Requires authentication

Примеры кода для "List subscriptions for the authenticated user (stubbed)"

Пример запроса

get/user/marketplace_purchases/stubbed
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" ] } } ]