Workflow logic to interact with 2 API (1 export, 1 import)


My plan is to export from source (#1 in screenshot), and then import into another instance via API call. Based on screenshot above
#1 above are steps to auth > pull locations (node = “FPC.SF.GetLocations”)
#2 “Get BPO Token” is to get my target instance’s token ready, then after “Code1” node is completed, i need to push the locations into instance in “Get BPO Token6”

But the challenge now is the nodes looks a bit messy, coz after “Code1” node, i have to create a loop (for 40 items) and call API to import each location, but if i link it with “Get BPO Token6”, the import API will process after “Get BPO Token6” completed, before “FPC.SF.DMO01”. Meaning n8n trying to import before pulling any location (under node “FPC.SF.GetLocation”).

I believe it’s quite a common flow and anyone have working sample for me to reference? thanks

Information on your n8n setup

  • n8n version: 1.25.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker, self hosted
  • Operating system: win 11 pro

not sure why you mean by this

i need to push the locations into instance in “Get BPO Token6”

what exactly “Get BPO Token6” does? what is instance ? i assume you get some token from target API ?

I reorganize the nodes so that i could explain the challenge better


Objective: To copy list of locations (40 items) from source to target instance. Both instances are consume API from 2 platforms, they are completely different products so the API, auth mechanism are slightly different.
From the screenshot
#1: initiate a list of variables (e.g. BaseUrl, AppID/Secret, etc) > consume API to get target instance’s Token (so later looping can append in locations)
#2 - Get Assertion, Token to get the flow authenticated. In between nodes, there are many “merge” nodes implemented due to “http request” node output doesn’t remain input params (e.g. baseUrl, client id/secret, etc)
#3 - I am able to loop every single items (locations) but failed to make an import call to append each location into target instance (the one deactivated)

for the #3 looping, my program doesn’t function well when i use merge node (as below), it only run once but if i disabled it, it run each locations, which is quite puzzled

pointers and example are welcome~ :slight_smile:

what is the issue with it? Why did it fail?

And can you share the workflow (without any sensitive information)?
image

i wasn’t able to export/share the workflow even sensitive info removed. Coz we are still in evaluation state, building various use cases in n8n to justify how efficient it could streamline the works. I am the pioneer for the comp (currently in free, community ver, running in localhost)

even i try the workaround to copy & paste into notepad, and from there i paste to a blank workflow, hoping i could share the full detail, it prompted error which i am pretty sure it caused by the loop. I experienced it before

I will still share my workflow (credential removed) and in text file. Hoping the gurus can spot my mistake :slight_smile:

Really thanks for the support, we really need a great tool to support the challenging integration between services these days.

updates: i was able to download and share the complete json. hope tht helps to troubleshoot

hi team, i found my solution, after i learnt that i don’t need to use “merge” node but able to “call” output from any node in the same workflow
image

Now the workflow makes more sense and working well!


thanks all for the inspiration!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.