Skip to main content
Business Central forum
Suggested answer

how to get both header and line from single API call?

editSubscribe (0) ShareShare
ReportReport
Posted on by 62

hello Guys,

I have created Custom API Page for Header and Custom API Page for Line of Purchase Header.

Also I have added Part( Line,"Custom API Page for Line") with EntityName in Custom API Page (header). 

When I am calling  Custom API Page for Header only get Header data not getting Line data in Result.

 

Guide/ Help me here,

Thanks in Advance

Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 59,844 Super User on at
    RE: how to get both header and line from single API call?

    Hi, you can just use $expand.

    For example, api.businesscentral.dynamics.com/.../salesOrders?$expand=salesOrderLines

    More details: https://yzhums.com/6117/#toc13

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,025 on at
    RE: how to get both header and line from single API call?

    Hi,

    Pls share your code.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: how to get both header and line from single API call?

    Hi,

    Please refer the below link, it has a good examples

    www.kauffmann.nl/.../

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,714 Super User on at
    RE: how to get both header and line from single API call?

    You can find that source code here:

    github.com/.../pages

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,714 Super User on at
    RE: how to get both header and line from single API call?

    Havee you tried to compare your code with the standard API for purchase orders?

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans