Problem for input parameter with json rest APi 

 Problem for input parameter with json rest APi 

  

Hi All,


i have problem for input parameter with json format like below to RestApi,
where i have the arrUnit role in array format


  {
"oldOrderCode": "",
"payType": "2",
"membercode": "458867820011",
"membername": "F ADHITYA CHRISTANTO",
"pscode": "17843555",
"psname": "Keni",
"custemail": "keniamalia1@gmail.com",
"custphone": "081333660509",
"scmcode": "045",
"arrUnit": [
{
"unitcode": "FHP12",
"unitno": "1203",
"renovcode": "GO",
"termno": "2",
"sellingprice": "11542642000",
"bfamount": "20000000",
"remarks": "string",
"disc1": "90",
"disc2": "20",
"discType": "213312",
"discGroupName": "32342342"
}
],
"arrPP": [
{
"PPNo": ""
}
],
"username": "458867820011",
"userref": "95",
"ResiImg": "",
"finishRedirect": "",
"unfinishRedirect": "",
"errorRedirect": ""
}


how can post action with json format above?


Thanks,

Imas Deny 

Hi imas,

What is exactly the problem?

Because the json in your example works fine as a parameter for the web service.

Just a small note on arrays in json:

  • The arrays in json are lists in OutSystems.
  • Thus, your attribute ArrUnit will be a List of ArrUnitItem
  • So, in your logic before calling the REST service you will have to built that list.
  • That can be done by:
    • Having a variable of type ArrUnitItem (which is a structure)
    • For each item that you want in the List, assign values to your variable and use ListAppend to add that item to the list (attribute ArrUnit)

Cheers,

José