# Cql query using request api to confluence

**URL:** <https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080>\
**Category:** Jira Data Center\
**Tags:** authentication, python, getting-started, rest-api\
**Created:** [March 29, 2022, 8:49pm UTC](https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080 "2022-03-29T20:49:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto1](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@Roberto1](https://community.developer.atlassian.com/u/Roberto1)\
**Post date:** [March 29, 2022, 8:49pm UTC](https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080/1 "2022-03-29T20:49:35Z")

</div>

hi, im using python’s request module and get a 200 only when using the base url. If i try adding /rest/api/content/search i cannot pass my query.

could it be my authentication ? im passing it like this : response = requests.get(url, auth=(email, token), params, headers=blabla).json()  
i have searched the internet for a solution, read the documentation but still missing something.  
thanks, any help is appreciated.

---

<div class="post-metadata">

**Author:** ![ibuchanan](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ibuchanan/32/35815_2.png) [@ibuchanan](https://community.developer.atlassian.com/u/ibuchanan)\
**Post date:** [March 29, 2022, 10:09pm UTC](https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080/2 "2022-03-29T22:09:41Z")

</div>

Welcome to the Atlassian developer community @Roberto1,

I don’t think there’s enough information in your question to know if it is auth. Have you tried the email & token with a simpler HTTP client like curl?

I think what would help is to see the full HTTP request that Python request is constructing. There’s [a lot of methods for intercepting the HTTP request on StackOverflow](https://stackoverflow.com/questions/10588644/how-can-i-see-the-entire-http-request-thats-being-sent-by-my-python-application) and any 1 of them would help with diagnosis.

---

<div class="post-metadata">

**Author:** ![Roberto1](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@Roberto1](https://community.developer.atlassian.com/u/Roberto1)\
**Post date:** [March 31, 2022, 6:04pm UTC](https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080/3 "2022-03-31T18:04:59Z")

</div>

ok, after a few tests, i figured it out. i had to include the “Authorization” : “Bearer mytoken”  
in the headers , i can see in the admin settings that i was authenticated.

---

<div class="post-metadata">

**Author:** ![ibuchanan](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ibuchanan/32/35815_2.png) [@ibuchanan](https://community.developer.atlassian.com/u/ibuchanan)\
**Post date:** [March 31, 2022, 8:42pm UTC](https://community.developer.atlassian.com/t/cql-query-using-request-api-to-confluence/57080/4 "2022-03-31T20:42:19Z")

</div>

@Roberto1,

I’m glad that you found something that works but I would like to clarify that API tokens do not require being sent as `Bearer` tokens. They are intended to work with simple [basic auth](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/).
