Skip to main content

 

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!

Hi! 

You can do it like this: 

 Id_relatório = dataa'data']a'exportPipeReport']t'pipeReportExport']t'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.


WOW! Tks! Worked fine!