nntrn / save

https://nntrn.github.io/save/
2 stars 0 forks source link

API notes #14

Open nntrn opened 1 year ago

nntrn commented 1 year ago

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

nntrn commented 1 year ago

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/
nntrn commented 1 year ago

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'
nntrn commented 1 year ago

Apple: Getting App and Book Information

nntrn commented 1 year ago

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}')"