Strange response from Github api

I have a strange issue.  I am using the github api to retrieve information concerning all of the gists for the user whose PAT is used to authenticate to Github.  I am doing this in powershell.  Below is the code:

$header = @{}
$header.add("Authorization", "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
$url = ""
$data = Invoke-RestMethod -Uri $url -Headers $header -Method Get

The part that is strange is that the api is only returning the first 30 gist items for the account, which is noticeable because this account has about 50 gists that it owns and hosts.  Any idea why this might be the case?  I find it very interesting that the api is only returning EXACTLY 30 entries each time.  Does the gist API endpoint use pagination or something?

1 Like

Did you make sure that all 50 of the user’s  Gists are public? Per the  GitHub Rest API v3 documentation:

List the authenticated user's gists or if called anonymously, this will return all public gists:
GET /gists

^ this endpoint will only return public  Gists of a specified user.

Maybe the api is returning the wrong version?

1 Like

Although that might be possible, I doubt that in this case. I say that because the endpoint is set to automatically grab information through their  third-version of the  GitHub REST API.

Hello all.  I am sure that all the gists are public.  Its odd, I know, but it will only return the first 30 of the 50 + public gists.

1 Like

Given the code provided in the first post, where “data” returns all of the public gists for a user, this is the “Count” property for the variable.


1 Like