Options

API Query in BC

AleAle Member Posts: 7
I want to make a custom API with items and customer discounts.
So I made a query and connected the item table to the Sales Line discount table.

query 50100 "Itemprice Entity"
{
QueryType = API;
Caption = 'Itemprice API', Locked = true;
APIPublisher = 'Me';
APIGroup = 'Client';
APIVersion = 'v1.0';
EntityName = 'itemprice';
EntitySetName = 'itemprices';


elements
{
dataitem(QueryElement1; Item)
{
column("articleNumber"; "No.") { }
column("price"; "Unit Price") { }
dataitem(QueryElement2; "Sales Line Discount")
{
DataItemLink = "Code" = QueryElement1."No.";
SqlJoinType = LeftOuterJoin;

column(discount; "Line Discount %") { }

}
}
}
}

When I publish this and test it with postman I get strange values back with 'auxiliaryIndex...'.
What am I doing wrong?
Sign In or Register to comment.