Ryan_NR
(Ryan)
30 Septiembre, 2019 14:34
1
Hi folks - I’m an admin user of our Discourse instance - but I’m unable to query certain endpoints.
Sometimes I get this:
Other times I am prompted with You need to be logged in to do that
I have confirmed the API key I’m using is attached to my Admin user, and that the API_Username is my own username - do you have any advice on this?
My guess is the call is not sending the credentials correctly?
blake
(Blake Erickson)
1 Octubre, 2019 13:14
3
You could try passing the api credentials in the header of the request instead of the query params. There should be an example in the api documentation topic.
1 me gusta
Ryan_NR
(Ryan)
1 Octubre, 2019 13:14
4
Could be - I’m not sure - The set up I have is just the Postman collection downloaded from here:
Discourse API
Please view the Discourse API Documentation site for detailed info:
https://docs.discourse.org
Deprecation Warning!
On April 6th, 2020 we dropped support for all non-HTTP header based authentication (excluding some rss, mail-receiver, and ics routes). This means that API requests that have an api_key and api_username in the query params or in the HTTP body of the request will soon stop working. Please see the example cURL request below for how to update your API requ…
I just changed out the API Key, Username, and Base URL.
Is this collection no longer valid?
1 me gusta
Ryan_NR
(Ryan)
1 Octubre, 2019 13:15
5
Thanks @blake I’ll give it a try
blake
(Blake Erickson)
1 Octubre, 2019 13:17
6
Yea some of them are probably outdated.
1 me gusta
Ryan_NR
(Ryan)
1 Octubre, 2019 13:21
7
@blake - Passing creds as a request header is returning the same:
{
"errors": [
"You are not permitted to view the requested resource."
],
"error_type": "invalid_access"
}
blake
(Blake Erickson)
1 Octubre, 2019 13:52
8
I was able to get the group members api request to work on meta with this curl command:
curl -i -sS -X GET "https://meta.discourse.org/groups/my-private-group/members.json" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: key" \
-H "Api-Username: username"
Maybe you can use the copy as curl command in Postman and compare.
6 Me gusta
system
(system)
Cerrado
31 Octubre, 2019 13:55
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.