Solved

Trying to get all pipes using Python

  • 23 September 2020
  • 1 reply
  • 525 views

Userlevel 5

Hi,  Can't figure what is wrong with my code in Python, I'm trying to get all the pipes from a company, my code is the following and the response I getting is 404, I already tried different things like make the "query" in a single row using "\" to escape the caracteres: import requests
 url = "https://api.pipefy.com/graphql"
 headers = {
 'authorization': "Bearer company_token",
 'content-type': "application/json"
 } query = """
 {
 "query": "{organization(id: 16094){pipes{id}}}"
 }
 """ response = requests.get(url, data=query, headers=headers) print(response.text)

icon

Best answer by Marcos Carvalho 25 September 2020, 16:35

View original

1 reply

Userlevel 6
Badge +6

Hey Nigel, 

 

Some escaping is missing in your request. 

 

Here the query in Python to get the pipes in a organization: 

 

import requests

url = "https://api.pipefy.com/graphql"

payload = "{\"query\":\"{ organization(id: 307747) { pipes { id name } } }\"}"
headers = {
"authorization": "Bearer YOUR_TOKEN",
"content-type": "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

 

 

If you have any doubts on converting the query for Python, you can check our console with some examples in cURL, Node, Ruby, JS and Python :) 

https://developers.pipefy.com/reference#graphql-endpoint

 

 

Reply