Skip to main content
Solved

API call | exportPipeReport | I'not retrieving ID from json return


Diego Anselmo Saiotti

 

Hi!

 

I’m trying to recover one specific info from a POST that i’ve done.

import requests
import json

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

payload = {"query": "mutation {exportPipeReport(input: { pipeId:\"XXXXX\", pipeReportId: \"XXXXX\"}) {pipeReportExport {id}}}"}
headers = {
    "Authorization": "Bearer XXXX",
    "Content-Type": "application/json"
}

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

Id_relatorio = data['data']

print(Id_relatorio)

I’m using python 3, but i can only recover the entire data: 

{
  "data": {
    "exportPipeReport": {
      "pipeReportExport": {
        "id": "302968765"
      }
    }
  }
}

 

Do you have any idea how to manipulate the returning JSON, with python, in order to print only the “ID” info?

 

Thanks!

Best answer by João Nicolete

Hi! 

You can do it like this: 

 Id_relatório = data['data']['exportPipeReport']['pipeReportExport']['id']

That way you will retrieve just the id value from the JSON. 

Let us know if that works or if you run throught any problems.

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

João Nicolete
Pipefy Staff

Hi! 

You can do it like this: 

 Id_relatório = data['data']['exportPipeReport']['pipeReportExport']['id']

That way you will retrieve just the id value from the JSON. 

Let us know if that works or if you run throught any problems.


Diego Anselmo Saiotti

WOW! Tks! Worked fine!


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