Hi ,
I am setting a rest call using Integration Smart Service and on the field which is text I need to sent a sprecific structure like follow:
{ { "Name": "Name1","Value": pv!Value1},{ "Name": "Name2","Value": pv!Value2}} .
I try several different scenarios but nothing is complete as expected.
Please advice me how to proceed.
Thanks in advance.
Discussion posts and replies are publicly visible
If the integration object expects text in JSON format, the putting your code inside a toJson() should help. Did you try that? How does the integration object look like?
For one of the application from expression rule ICARM_Define_Parametarts
I sent in output
{{
"Name" : "requested", "Value" :ri!SystemInfo.Firewall_requestedFor}, {"Name":"Source", "Value": ri!SystemInfo.Firewall_sourceAD_IP}, {"Name":"Destination", "Value": ri!SystemInfo.Firewall_destinationIPs}}
And on the Integration Smart I sent the data in format
a!toJson (rule!ICARM_Define_Parametarts(pv!SystemInfo).
The other approach that I try is to same the data into process variable define as CDT with structure.
and than sent the data a!tojson pv!variable)
But no one of this two scenarios worked.
BR,Natasa
a!tojson (rule!Expression
Do you see any error messages? Please post them. Can you provide a screenshot of the integration object?
OK. I think this is pretty clear. The integration expects a data structure but not a string. What happens if you remove the toJson()?
It is the same but only the value is with [ not with { as expected.
It is not the same. The parameter expects a data structure and not a string. Please add a screenshot of how the parameter assignment looks like.
In Appian, square brackets "[ ]" are only used to index an item in a list or a field in a CDT. Even if it looks like JSON, it is not the same.
Hi,
We just have some improvement but I need a little help once more. So I sent it without a!tojson and the request is going but on the other site we have
"{\"Name\":\"distributionPlace\",\"Value\":\"008M- САЛОН ТЦ ВЕРО\"}"
So my question is prevent and sent it like this
{\"Name\":\"distributionPlace\",\"Value\":\"008M- САЛОН ТЦ ВЕРО\"}
without " at the begining and end.
Maybe tostring () or somethig else will prevent ?
It is really hard to understand what is going on.
I suggest to test the integration objects itself. Not via a process model. Once that works, you will have abetter understanding of the data to pass in.
Once again, I would like to see how the integration object looks like.
From integration definition and postman it works
OK. Then I need a screenshot of the call integration node showing how you pass the values. Similar to the screenshot above, but click on "SystemRolesDetails" first.
We have systems where this parameters is null and those calls are OK the problem are the call where we have parameters.
Here is the body of the integration:
=a!toJson({ "AppianID" : ri!AppianID, "GetProvisioningApproversInfo":{ "SystemID":ri!SystemRolesDetails.SystemID, "roleID": ri!SystemRolesDetails.RoleID[1], "moduleID": ri!SystemRolesDetails.ModuleID, "employeeID":ri!SystemRolesDetails.EmployeeID, "ContractID" : ri!ContractID, "ADUserNameRequstby":ri!SystemRolesDetails.ADUserNameRequstby, "validTo" : ri!ValidTo, "validFrom" : ri!ValidFrom, "Parameters" : ri!Parametarts }})
This is what you need?
OK. So this is all about "Parameters"? Which data type is "ri!Parametarts" (Is this a typo?)? String? If yes, why?
What I see is that it seems that the API expects a list of Name/Value pairs. The easiest way to create this is like you initially did
{ { "Name": "requested", "Value" : ri!SystemInfo.Firewall_requestedFor }, { "Name": "Source", "Value": ri!SystemInfo.Firewall_sourceAD_IP }, { "Name": "Destination", "Value": ri!SystemInfo.Firewall_destinationIPs } }
But make the rule input "Parametarts" (Typo?) an "any" type. This way you pass a data structure into the integration. Here it is added to the internal data structure and then it is turned into JSON altogether.
BTW an integration turns a dictionary or CDT into JSON on its own. The toJson() is not needed.