10-30-2023 02:20 PM
Hello!
I'm new to this board and SnapLogic in general, so this should be an easy one to resolve... 🙂
I'm creating a very simple pipeline where I use a HTTP client to read a list of ongoing, "live" projects tracked on a server, then I need to use that list to create new project shells (projects with no data except the project name) in a different system. I basically replicate projects from one system to another by using only their names.
From the HTTP client response to query the list of projects metadata I use a JSON splitter to get an array of strings for the project names only (jsonPath($, "entity.results[*].name")), then I use a JSON generator to prepare the payload for the next step, which is the creation of new projects on a different system, using the list of project names as input, and the HTTP client to POST the requests.
What I get from the JSON splitter seems valid, here's an example:
[
{"splitValue":"Name of the first project"},
{"splitValue":"Name of the second project"},
{"splitValue":"Name of the third project"},
{"splitValue":"Name of the fourth project"}
]
This is the JSON that I'm trying to create as payload for the next HTTP client step:
{
"name": "${_splitValue}",
"customerId": 771373363,
"templateId": 86723995468
}
That doesn't work, here's what I'm getting as response (error message):
Solved! Go to Solution.
10-31-2023 12:14 PM
I didn't notice before, but you don't want to have anything in the Multipart sub-type property. Clear that $ from the expression and uncheck the expression enabler.
10-31-2023 12:01 PM
Actually, the Content-Type should probably be "text/plain" since the values you are sending are just a string or numeric - it's not really JSON. I believe that is what is complaining about at this point.
Let me know if that still doesn't work.
10-31-2023 12:11 PM
Hello again @koryknick,
Thanks for your quick input!
I'm unfortunately having the same error when I change the Content-Type:
Kind regards,
JF
10-31-2023 12:14 PM
I didn't notice before, but you don't want to have anything in the Multipart sub-type property. Clear that $ from the expression and uncheck the expression enabler.
10-31-2023 12:25 PM
Hello again @koryknick,
Thanks again, it worked this time! 🙂
The only change I made to your reply was to enabling the expression button for the "name" field and get the value from the passed list otherwise all my projects were labelled "name":
It's all good now, thanks a lot again for your help!
Kind regards,
JF