Skip to main content

blocking

Creates, updates, deletes, gets or lists a blocking resource.

Overview

Nameblocking
TypeResource
Idgithub.orgs.blocking

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger (int64)
namestring
gravatar_idstring (example: 41d064eb2195891e12d0413f63227ea7)
node_idstring (example: MDQ6VXNlcjE=)
avatar_urlstring (uri) (example: https://github.com/images/error/octocat_happy.gif)
emailstring
events_urlstring (example: https://api.github.com/users/octocat/events{/privacy})
followers_urlstring (uri) (example: https://api.github.com/users/octocat/followers)
following_urlstring (example: https://api.github.com/users/octocat/following{/other_user})
gists_urlstring (example: https://api.github.com/users/octocat/gists{/gist_id})
html_urlstring (uri) (example: https://github.com/octocat)
loginstring (example: octocat)
organizations_urlstring (uri) (example: https://api.github.com/users/octocat/orgs)
received_events_urlstring (uri) (example: https://api.github.com/users/octocat/received_events)
repos_urlstring (uri) (example: https://api.github.com/users/octocat/repos)
site_adminboolean
starred_atstring (example: "2020-07-09T00:17:55Z")
starred_urlstring (example: https://api.github.com/users/octocat/starred{/owner}{/repo})
subscriptions_urlstring (uri) (example: https://api.github.com/users/octocat/subscriptions)
typestring (example: User)
urlstring (uri) (example: https://api.github.com/users/octocat)
user_view_typestring (example: public)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_blocked_usersselectorgper_page, pageList the users blocked by an organization.
check_blocked_userexecorg, usernameReturns a 204 if the given user is blocked by the given organization. Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.
block_userexecorg, usernameBlocks the given user on behalf of the specified organization and returns a 204. If the organization cannot block the given user a 422 is returned.
unblock_userexecorg, usernameUnblocks the given user on behalf of the specified organization.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
usernamestringThe handle for the GitHub user account.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

List the users blocked by an organization.

SELECT
id,
name,
gravatar_id,
node_id,
avatar_url,
email,
events_url,
followers_url,
following_url,
gists_url,
html_url,
login,
organizations_url,
received_events_url,
repos_url,
site_admin,
starred_at,
starred_url,
subscriptions_url,
type,
url,
user_view_type
FROM github.orgs.blocking
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;

Lifecycle Methods

Returns a 204 if the given user is blocked by the given organization. Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.

EXEC github.orgs.blocking.check_blocked_user 
@org='{{ org }}' --required,
@username='{{ username }}' --required
;