Hi @shrey-42 ,
Here you go:
I get first the dates and then get the seance_length
{
"nodes": [
{
"parameters": {
"functionCode": "return items[0].json.booking_dates.map(booking_dates => { return { json: { booking_dates } } });\nreturn items;\n"
},
"name": "APIanswer",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1171,
334
]
},
{
"parameters": {
"path": "yclients",
"responseMode": "lastNode",
"responseData": "allEntries",
"options": {}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
631,
334
],
"webhookId": "63792496-dda3-43cd-bd17-f2cd0349f4ae"
},
{
"parameters": {
"authentication": "headerAuth",
"url": "=https://api.yclients.com/api/v1/book_dates/",
"options": {}
},
"name": "dateHTTP",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
767,
334
],
"credentials": {
"httpHeaderAuth": "yclient"
}
},
{
"parameters": {
"authentication": "headerAuth",
"url": "=https://api.yclients.com/api/v1/book_times//0/{{$json[\"booking_dates\"]}}",
"options": {}
},
"name": "seance",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1341,
334
],
"credentials": {
"httpHeaderAuth": "yclient"
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "booking_dates",
"value": "={{ $node[\"dateHTTP\"].json[\"booking_dates\"] }}"
}
]
},
"options": {}
},
"name": "dates",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
981,
334
]
},
{
"parameters": {
"functionCode": "const result = [];\nconst timeitems = items[0].json;\nfor(const time of timeitems) {\n time.map(i => ({json:i})).forEach(j => result.push(j));\n}\nreturn result;\n"
},
"name": "Flat JSON to Join dates with seance",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1530,
330
]
}
],
"connections": {
"APIanswer": {
"main": [
[
{
"node": "seance",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "dateHTTP",
"type": "main",
"index": 0
}
]
]
},
"dateHTTP": {
"main": [
[
{
"node": "dates",
"type": "main",
"index": 0
}
]
]
},
"seance": {
"main": [
[
{
"node": "Flat JSON to Join dates with seance",
"type": "main",
"index": 0
}
]
]
},
"dates": {
"main": [
[
{
"node": "APIanswer",
"type": "main",
"index": 0
}
]
]
}
}
}
Thank you very much.