API notes

https://github.com/nntrn/save/issues/14

Created on Last updated on


Wikipedia

# Request an access token using an authorization code
curl -X POST \
  -F 'grant_type=authorization_code' \
  -F 'code=YOUR_AUTHORIZATION_CODE' \
  -F 'client_id=YOUR_CLIENT_ID' \
  -F 'client_secret=YOUR_CLIENT_SECRET' \
  https://meta.wikimedia.org/w/rest.php/oauth2/access_token

Source

https://en.wikipedia.org/api/rest_v1/#/Reading%20lists/get_data_lists_

https://stackoverflow.com/questions/1625162/get-text-content-from-mediawiki-page-via-api

Bureau of Labor Statistics' (BLS)

curl -H 'Content-Type: application/json' \
  -d '{"seriesid":["LEU0254555900", "APU0000701111"], "startyear":"2012", "endyear":"2022"}' \
  https://api.bls.gov/publicAPI/v2/timeseries/data/

Firefox Daily Usage

Daily Usage shows the hours spent browsing for a typical Firefox Desktop client in a typical day of use.

curl 'https://data.firefox.com/datasets/desktop/user-activity/United%20States/avg_daily_usage(hours)/index.json'

Apple: Getting App and Book Information

Gitlab GraphQL

QUERY='{
  projects(first: 100) {
    nodes {
      name
      id
      lastActivityAt
      createdAt
      description
      httpUrlToRepo
      starCount
      visibility
    }
  }
}'

curl 'https://gitlab.com/api/graphql' \
  -H "PRIVATE-TOKEN: $GITDELL_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Origin: https://gitlab.com' \
  -H 'Referer: https://gitlab.com/-/graphql-explorer' \
  --data-raw "$(jq -c -n --arg query "$QUERY" '{"query":$query}')"