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"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
per_page integer The number of results per page (max 100). Padrão: |
page integer Page number of the results to fetch. Padrão: |
Códigos de status de resposta HTTP para "List social accounts for the authenticated user"
Código de status | Descriçã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"
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
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"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
account_urls array of strings ObrigatórioFull 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 status | Descriçã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"
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
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"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
account_urls array of strings ObrigatórioFull 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 status | Descriçã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"
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
Lists social media accounts for a user. This endpoint is accessible by anyone.
Parâmetros para "List social accounts for a user"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
username string ObrigatórioThe handle for the GitHub user account. |
Nome, Type, Descrição |
---|
per_page integer The number of results per page (max 100). Padrão: |
page integer Page number of the results to fetch. Padrão: |
Códigos de status de resposta HTTP para "List social accounts for a user"
Código de status | Descrição |
---|---|
200 | OK |
Exemplos de código para "List social accounts for a user"
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"
}
]