Invoking Actions with Complex Data Type Parameter

In OData actions, structure type parameters need to be represented using JSON Objects in the request payload.

Example

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.

With All Attributes

{
  "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"
        }
      }
    ]
  }
}

With Some Attributes

{
  "StructPara": {
    "RootAlpha": "Alpha1",
    "RootDate": "2018-10-01",
    "Children": [
      {
        "Level1Integer": 1,
        "Level1Enum": "Car",
        "Child": {
          "Level2Number": 1.95
        }
      },
      {
        "Level1Integer": 3,
        "Level1Enum": "Suv"
      }
    ]
  }
}

Marble code for the above action and Complex type

Action

action ActionStructBindTestUb Text {
  initialcheck none;
  parameter StructPara Structure(RootStruct);
}

Example code - Marble action

Structures

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

Back