I am trying to connect up to an API and in their documentation I need to create inside an http request an array like this:
'plainPassword' => array(
'password' => 'topSecret007',
'confirm' => 'topSecret007',
),
how would i add this to a body parameter ?
Surge.Media:
plainPassword
So as I know js does not support associative arrays, so you could use js object:
Or you could make manipulate object to string to have this syntax
1 Like
jan
December 26, 2021, 1:42pm
3
In case you have to send it as an actual array, then you would have to set an expression like this:
{{ {"plainPassword": [{"password": "topSecret007", "confirm": "topSecret007" }]} }}
Here an example workflow:
1 Like
Thanks both for the advice. I have tried multiple variations however nothing is working for me yet.
From the mautic API this is what I am meant to be doing:
$data = array(
'username' => 'apitest',
'firstName' => 'John',
'lastName' => 'Doe',
'email' => '[email protected] ',
'plainPassword' => array(
'password' => 'topSecret007',
'confirm' => 'topSecret007',
),
'role' => 1,
);
This is what i have tried to do so far
Try it like this: {{ {"password":"topSecret007", "confirm": "topSecret007" } }}
1 Like
Thanks @RicardoE105 - that did the trick! Much appreciated.
Great that it worked. Have fun.
could i get a little bit more help… how would i pass a node value into this ?
{{ {"password":"{{$node["Set"].json["password"]}}", "confirm": "{{$node["Set"].json["password"]}}" } }}
when i view the result i get this
[invalid (Expression is not valid: Unexpected string)]", “confirm”: “mike1234” } }}
jan
December 27, 2021, 7:17am
9
You would have to use:
{{ {"password": $node["Set"].json["password"], "confirm": $node["Set"].json["password"] } }}
Honestly this is the fastest forum i have ever worked on. This is the most incredible piece of technology developed changing the way less technical people can work.
Thank you so much for this amazing product and the great support!!
5 Likes
jan
December 27, 2021, 7:41am
11
Thanks a lot! That is great to hear! We may not be able to promise you that it will be always that fast but we are definitely always doing our best!
3 Likes