In OData actions, structure type parameters need to be represented using JSON Objects in the request payload.
Following request is to “ActionStructBindTestUb” action which has RootStruct Complex Typed parameter.
http[s]://{host}:{port}/{main|b2b}/ifsapplications/projection/v1/Operations.svc/ActionStructBindTestUb
The request payload needs to be as follows.
{ "StructPara": { "RootAlpha": "Alpha1", "RootBoolean": true, "RootDate": "2018-10-01", "Children": [ { "Level1Integer": 1, "Level1Enum": "Car", "Child": { "Level2Number": 1.95, "Level2Text": "Text1" } }, { "Level1Integer": 3, "Level1Enum": "Suv", "Child": { "Level2Number": 3.69, "Level2Text": "Text2" } } ] } }
{ "StructPara": { "RootAlpha": "Alpha1", "RootDate": "2018-10-01", "Children": [ { "Level1Integer": 1, "Level1Enum": "Car", "Child": { "Level2Number": 1.95 } }, { "Level1Integer": 3, "Level1Enum": "Suv" } ] } }
action ActionStructBindTestUb Text { initialcheck none; parameter StructPara Structure(RootStruct); }
Example code - Marble action
structure RootStruct { attribute RootAlpha Alpha; attribute RootDate Date; attribute Children List<Structure(Level1Struct)>; } structure Level1Struct { attribute Level1Integer Integer; attribute Level1Enum Enumeration(VehicleType); attribute Child Structure(Level2Struct); } structure Level2Struct { attribute Level2Number Number; attribute Level2Text Text; }
Example code - Marble structure