sckott / discgolf

Discourse API R client
https://sckott.github.io/discgolf/
Other
6 stars 3 forks source link

users_list API point changed #12

Closed steffilazerte closed 4 years ago

steffilazerte commented 4 years ago

Looks like the API point for users_list() has changed, or at least this doesn't work for the ropensci forums:

library(disgolf)
user("steffilazerte") # No problem
users_list("active")  # Error: Not Found (HTTP 404)

Looking at the Discourse API docs it appears that it's a new url and format?

This gets the first 50 users with the option to paginate...

resp <- httr::GET(file.path(Sys.getenv("DISCOURSE_URL"), "directory_items.json"),
            query = list(period = "all", order = "days_visited"))
resp <- httr::content(resp, as = "parsed")
sckott commented 4 years ago

thanks!

users_list is for this route https://docs.discourse.org/#tag/Users/paths/~1admin~1users~1list~1{flag}.json/get - but correct that it's not working. not sure why. it seems to work in the browser

ahh, it seems they've changed auth key and username to be a request header instead of query param, which is a good change

sckott commented 4 years ago

should work now