List user's subscriptions in an organization he is member of

Hi,

I’d like to list the organisation subscriptions I am a member of and change their notification settings programmatically.

~$ curl -s -H "Authorization: token ${token}" \
"https://api.github.com/users/${user}/subscriptions?type=all" | jq -c .[] | wc -l
3

Returns only my subscriptions and not my organisation’s.

I was not able to find anything in the API documentation on how to achieve what I need.

My goal is to list subscriptions and to change the notification setting from “watching” to “releases only”.

Thanks for any help.

r

:wave: Hey @biro70! That’s interesting behavior to report. Would you mind also sharing the response that you get for that request?

When I run that request for your account, I’m able to see a subscription to an organization-owned repositories:

curl -v -H "Authorization: token $TOKEN" "https://api.github.com/users/biro70/subscriptions?per_page=100"

[
  // ...
  {
    "id": 239826107,
    "node_id": "MDEwOlJlcG9zaXRvcnkyMzk4MjYxMDc=",
    "name": "irules-toolbox",
    "full_name": "f5devcentral/irules-toolbox",
    "private": false,
  // ...
  }
]

Similarly, I’m able to see subscriptions for my user account for both user-owned and organization-owned repositories:

curl -v "https://api.github.com/users/francisfuzz/subscriptions?per_page=100"

I’d like to mention that this endpoint doesn’t have any documented input, so ?type=all will be ignored here. Also, this only considers subscriptions to public repositories.

If you’re interested in fetching subscriptions for both public and private repositories, it may be worth trying the endpoint for fetching a list of repositories watched by the authenticated user.

1 Like

Hi @francisfuzz. Thank you for your reply.
I am quite a novice when it comes to use GitHub API calls.
It was my own fault I couldn’t list the company’s private repositories.
The auth token I generated didn’t have the flag set to access subscriptions.
:man_facepalming:
Anyway all sorted now, also with the help of GitHub support member called Robert.

Thanks!
R

1 Like