Home > Forum > Actions > Rest Web service - item lists

Rest Web service - item lists
0

Hi!

Is possible using REST WEB SERVICE to sent:

{
"type": 0,
"firm": 0,
"id": 0,
"ord": 0,
"description": "string",
"lines": [ //Item list
{
"ord": 0,
"value": 0,
"type": 0,
"percent": 0,
"direction": 0,
"dimensions": [
{
"id": 0,
"type": 0
},
{
"id": 0,
"type": 0
}
]
}
]
}

When I use 'Json grid' I don't know how to add second 'dimensions' When I use 'json' they don't display list values.

MVP
In reply to: Maksymilian Stachowiak

Hello,
I'm not 100% sure, but it might not be possible.

I've tried once sending request with nested arrays with SOAP action, but i got an information there, that's not supported - not sure if thats case for REST response.

Hi Krzystof,

if you are running at least SQL Server 2014 and have the compatibility level set at least to this level, you could switch from JSON-Grid to JSON and execute business rule to generate the body.

I've put together an SQL statement which returns the structure in your screenshot. I'm assuming that the dimensions is a picker field for which multi values are allowed.
The screenshot shows the result.
Best regards,
Daniel

select
Top 1 as type
, 2 as firm
, 3 as id
, 4 as ord
, 'description' as [description]
,
( select
DET_ID as ord
,DET_Att1 as value
, '' as type
,0 as [percent]
, 0 as direction
, (
(select dbo.ClearWFElemId(item) as id , dbo.ClearWFElem(item) as type
from dbo.SplitToTable(
(
select DET_Att1 --Dimension field
from WFElementDetails dimensionField where dimensionField.DET_ID = rows.DET_ID
),';') as temp
for json path
)

) as dimensions
from WFElementDetails as rows
where DET_WFDID = WFD_ID
-- DET_WFCONID = ??
for json path
) as lines
from WFElements
where WFD_ID = 304
FOR JSON auto, WITHOUT_ARRAY_WRAPPER