I followed this post to retrieve discussions from a tag using the following URL
https://discuss.flarum.org/api/discussions?filter[q]=tag:dev
It works great, but when the tag is restricted to member-only, it gets nothing. I suspect this is an authorization issue so I followed this post to add a master token into the api_keys table of the flarum database. the record is like this:
MariaDB [flarumdb]> select * from api_keys
-> ;
+--------+----+-------------+--------+---------+---------------------+------------------+------------------------------------------+
| key | id | allowed_ips | scopes | user_id | created_at | last_activity_at | token |
+--------+----+-------------+--------+---------+---------------------+------------------+------------------------------------------+
| master | 1 | NULL | NULL | 1 | 0000-00-00 00:00:00 | NULL | YQobAWLhrHn0wGS6BrwW639Hx9sLzIoYF5KjUt6q |
+--------+----+-------------+--------+---------+---------------------+------------------+------------------------------------------+
But it still returns nothing, please help:
I use the httr package in R.
library(httr)
test =
GET(
"https://d.owaraiclub.com/api/discussions?filter[q]=tag:bd",
add_headers(Authorization='Token YQobAWLhrHn0wGS6BrwW639Hx9sLzIoYF5KjUt6q; userId=1')
)
content(test, "text")
#> No encoding supplied: defaulting to UTF-8.
#> [1] "{\"links\":{\"first\":\"https:\\/\\/d.owaraiclub.com\\/api\\/discussions?filter%5Bq%5D=tag%3Abd\"},\"data\":[]}"
<sup>Created on 2019-10-17 by the reprex package (v0.3.0)</sup>