Skip to main content
Solved

Trying to get all pipes using Python

  • September 23, 2020
  • 1 reply
  • 725 views

Nigel O'connell
Pipefy Staff

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)

Best answer by Marcos Carvalho

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

 

 

View original
Did this topic help you find an answer to your question?

1 reply

Marcos Carvalho
Pipefy Staff
Forum|alt.badge.img+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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings