Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Contas sociais

Use a API REST para gerenciar as contas de rede social dos usuários autenticados.

Sobre a administração de contas de rede social

Se uma URL de solicitação não incluir um parâmetro {username}, a resposta será para o usuário conectado (e você precisará transmitir as informações de autenticação com a solicitação). Informações particulares adicionais, como se um usuário tem a autenticação de dois fatores habilitada, são incluídas quando autenticado por meio do OAuth com o escopo user.

List social accounts for the authenticated user

Lists all of your social accounts.

Parâmetros para "List social accounts for the authenticated user"

Cabeçalhos
Nome, Type, Descrição
accept string

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

Parâmetros de consulta
Nome, Type, Descrição
per_page integer

The number of results per page (max 100).

Padrão: 30

page integer

Page number of the results to fetch.

Padrão: 1

Códigos de status de resposta HTTP para "List social accounts for the authenticated user"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Exemplos de código para "List social accounts for the authenticated user"

get/user/social_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/user/social_accounts

Response

Status: 200
[ { "provider": "twitter", "url": "https://twitter.com/github" } ]

Add social accounts for the authenticated user

Funciona com GitHub Apps

Add one or more social accounts to the authenticated user's profile. This endpoint is accessible with the user scope.

Parâmetros para "Add social accounts for the authenticated user"

Cabeçalhos
Nome, Type, Descrição
accept string

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

Parâmetros do corpo
Nome, Type, Descrição
account_urls array of strings Obrigatório

Full URLs for the social media profiles to add.

Códigos de status de resposta HTTP para "Add social accounts for the authenticated user"

Código de statusDescrição
201

Created

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Add social accounts for the authenticated user"

post/user/social_accounts
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/social_accounts \ -d '{"account_urls":["https://facebook.com/GitHub","https://www.youtube.com/@GitHub"]}'

Response

Status: 201
[ { "provider": "twitter", "url": "https://twitter.com/github" } ]

Delete social accounts for the authenticated user

Funciona com GitHub Apps

Deletes one or more social accounts from the authenticated user's profile. This endpoint is accessible with the user scope.

Parâmetros para "Delete social accounts for the authenticated user"

Cabeçalhos
Nome, Type, Descrição
accept string

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

Parâmetros do corpo
Nome, Type, Descrição
account_urls array of strings Obrigatório

Full URLs for the social media profiles to delete.

Códigos de status de resposta HTTP para "Delete social accounts for the authenticated user"

Código de statusDescrição
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Delete social accounts for the authenticated user"

delete/user/social_accounts
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/social_accounts \ -d '{"account_urls":["https://facebook.com/GitHub","https://www.youtube.com/@GitHub"]}'

Response

Status: 204

List social accounts for a user

Funciona com GitHub Apps

Lists social media accounts for a user. This endpoint is accessible by anyone.

Parâmetros para "List social accounts for a user"

Cabeçalhos
Nome, Type, Descrição
accept string

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

Parâmetros de caminho
Nome, Type, Descrição
username string Obrigatório

The handle for the GitHub user account.

Parâmetros de consulta
Nome, Type, Descrição
per_page integer

The number of results per page (max 100).

Padrão: 30

page integer

Page number of the results to fetch.

Padrão: 1

Códigos de status de resposta HTTP para "List social accounts for a user"

Código de statusDescrição
200

OK

Exemplos de código para "List social accounts for a user"

get/users/{username}/social_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/users/USERNAME/social_accounts

Response

Status: 200
[ { "provider": "twitter", "url": "https://twitter.com/github" } ]