Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Custom API for Item details with Pictures

Posted on by 43
Hi All,

We are using On-Prem Business central,

i want to create a custom API which will send item detail , sales price detail and item picture with picture URL or binary string. i tried but in the picture content we are receiving only the media link URL and i don't know i to use this media link to show data in my web page, actually another application consuming this api.

below is my code.
 
query 50112 GetCustomerWithOrder
{
    QueryType = API;
    APIPublisher = 'QueryV1';
    APIGroup = 'QueryGroup';
    EntityName = 'Item';
    EntitySetName = 'Items';
 
    elements
    {
        dataitem(ItemDetails; Item)
        {
            column(ItemNo; "No.")
            {
 
            }
            column(Name; Description)
            {
 
            }
            column(Inventory; Inventory)
            {
 
            }
            column(Picture; Picture)
            {
 
            }
            column(Base_Unit_Price; "Unit Price")
            {
 
            }
            dataitem(Pricelist; "Sales Price")
            {
                DataItemLink = "Item No." = ItemDetails."No.";
                SqlJoinType = LeftOuterJoin;
                column(Unit_Price; "Unit Price")
                {
 
                }
                dataitem(pictures; "Picture Entity")
                {
                    DataItemLink = Id = ItemDetails.Picture;
                    SqlJoinType = LeftOuterJoin;
                    column(PictureContent; Content)
                    {
 
                    }
                }
            }
 
        }
    }
 
    var
        myInt: Integer;
 
    trigger OnBeforeOpen()
    begin
 
    end;
}
 
if anyone have any idea please let me know or you have any code snip you can share with me.

Thanks for your help.
 
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,639 Super User 2024 Season 2 on at
    Custom API for Item details with Pictures
    Hi, When you open this table directly, is there any data?
    The normal practice is Picture (Item table) ->  Content (table 2000000184 "Tenant Media")
     
    Hope this helps.
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans