Home > other >  Adding filter with curl for github api
Adding filter with curl for github api

Time:01-22

How do i add the 2fa filter in curl for the github api?Here is an image of the documentation page, however it does not specify how to add the filter for 2fa.

Thanks so much!

I have tried using a "?": curl
-H "Accept: application/vnd.github json"
-H "Authorization: Bearer """
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/orgs/"my_org_name"/members?2fa_disabled

CodePudding user response:

According to the documentation, the query-parameter you need is called filter with the value 2fa_disabled. Therefore your curl command should look the following:

curl \
  -H "Accept: application/vnd.github json" \
  -H "Authorization: Bearer <YOUR-TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/orgs/ORG/members?filter=2fa_disabled

Keep in mind that this options is only available for organization owners.

Documentation: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members

  • Related