# Discourse API - Unable to query certain endpoints

**URL:** https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863
**Category:** Support
**Created:** [September 30, 2019, 2:34pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863 "2019-09-30T14:34:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Ryan\_NR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_nr/32/133654_2.png) [@Ryan\_NR](https://meta.discourse.org/u/Ryan_NR)
#### Post date: [September 30, 2019, 2:34pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/1 "2019-09-30T14:34:04Z")

</div>

Hi folks - I’m an admin user of our Discourse instance - but I’m unable to query certain endpoints.

Sometimes I get this:

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/7/5783a7d1471cc6d9f7a8acbf4012d049558440cf.png)

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 1, 2019, 3:54am UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/2 "2019-10-01T03:54:51Z")

</div>

My guess is the call is not sending the credentials correctly?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 1, 2019, 1:14pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/3 "2019-10-01T13:14:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Ryan\_NR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_nr/32/133654_2.png) [@Ryan\_NR](https://meta.discourse.org/u/Ryan_NR)
#### Post date: [October 1, 2019, 1:14pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/4 "2019-10-01T13:14:49Z")

</div>

Could be - I’m not sure - The set up I have is just the Postman collection downloaded from here:

> [@Discourse REST API Documentation](https://meta.discourse.org/t/discourse-api-documentation/22706):
>
> Discourse API Please view the Discourse API Documentation site for detailed info: [https://docs.discourse.org](https://docs.discourse.org)information_source Authentication API requests must use HTTP header based authentication. Pass your Api-Key and Api-Username as HTTP headers. Authentication via query parameters or request body is not supported (this was removed in April 2020). Please see the example cURL request below. The only API endpoints that continue to support credentials in query parameters are requests to…

I just changed out the API Key, Username, and Base URL.

Is this collection no longer valid?

---

<div class="post-metadata">

### Author: ![Ryan\_NR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_nr/32/133654_2.png) [@Ryan\_NR](https://meta.discourse.org/u/Ryan_NR)
#### Post date: [October 1, 2019, 1:15pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/5 "2019-10-01T13:15:03Z")

</div>

Thanks @blake I’ll give it a try

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 1, 2019, 1:17pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/6 "2019-10-01T13:17:35Z")

</div>

> [@Ryan\_NR](#):
>
> Is this collection no longer valid?

Yea some of them are probably outdated.

---

<div class="post-metadata">

### Author: ![Ryan\_NR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_nr/32/133654_2.png) [@Ryan\_NR](https://meta.discourse.org/u/Ryan_NR)
#### Post date: [October 1, 2019, 1:21pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/7 "2019-10-01T13:21:55Z")

</div>

@blake - Passing creds as a request header is returning the same:

```plaintext
{
    "errors": [
        "You are not permitted to view the requested resource."
    ],
    "error_type": "invalid_access"
}

```

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 1, 2019, 1:52pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/8 "2019-10-01T13:52:53Z")

</div>

I was able to get the group members api request to work on meta with this curl command:

```plaintext
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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 31, 2019, 1:55pm UTC](https://meta.discourse.org/t/discourse-api-unable-to-query-certain-endpoints/129863/9 "2019-10-31T13:55:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
