Question

How to show values from children object when GET an API source


I’m using the code bellow and the response has a child object, i´d like to use those childs values on my zap but i don´t know how can i could do that.

-----------------------------------------------------------------------

import requests

url = “https://api.example.com

payload={}
headers = {
‘api+pass_key’: 'api_pass_key
}

response = requests.request(“GET”, url, headers=headers, data=payload)

print(response.text)

------------------------------------------------------------------------------------

Result is:
“success”: true,
“content”: [
{
“detalhes”: [
{
“movement_id”: 398,
“invoice_id”: 133,
“tipo_conta”: 3,
“conta_id”: 96,
“valor”: 0,
“descricao”: “”,
“data”: “07-01-2022”
}
],
“pagamentos”: [
{
“pagamento_id”: 400,
“descricao”: “”,
“valor”: 540000,
“data”: “04-01-2022”,
“forma_pagamento”: 8,
“tipo_conta”: 3,
“conta_id”: 96,
“parcelas”: null,
“bandeira_id”: 1
}
“itens”: [
{
“item_id”: 176,
“agendamento_id”: 175,
“procedimento_id”: 2,
“descricao”: “”,
“tipo”: “S”,
“valor”: 0,
“desconto”: 0,
“acrescimo”: 0,
“quantidade”: 1,
“is_executado”: true,
“data_execucao”: “30-12-2021”,
“executante_id”: 1,
“associacao_executante_id”: 5,
“pacote_id”: null,
“centro_custo_id”: 0,
“categoria_id”: 0
}
]
},

I need to get ‘pagamentos’ values, and not content…

That’s it, if someone would help, i appreciate.

Tks


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @diegoantony 

You’ll need to use a Code step to parse the returned data points.

 

Userlevel 7
Badge +9

Hi @diegoantony 

Can you share a screenshot of how you are receiving the data from API, the result page in your Zap?

Since you are using JS, you should be able to parse directly using the code step. Otherwise, you can use webhook by Zapier to make the API call and the returned data comes at an already parsed state. Not sure what you meant by Values and Not content.

Any one?

Id like to use data inside ‘Itens’, ‘Detalhes’ and ‘Pagamentos’