Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

How can you implement multiple $expand in an API but not multilevel/cascading?

Posted on by 30

Hello, I've built a customer API with two SubPageLinks to both the Bank Accounts and the Ship-To Addresses. Now i am trying to GET the customer and $expand both the bankAccount and the shipToAddress in one request.

in two requests it works:

{{BC-Instance}}/{{API-Suffix}}/{{Company}}/customers('10000')?$expand=shipToAddresses

{{BC-Instance}}/{{API-Suffix}}/{{Company}}/customers('10000')?$expand=bankAccounts

 How is it possible to combine both expands in just one request?

  • kenyo Profile Picture
    kenyo 30 on at
    RE: How can you implement multiple $expand in an API but not multilevel/cascading?

    Thank you , yes that works after hours of looking for documentation i found the same answer in docs.oasis-open.org/.../odata-v4.01-csprd05-part1-protocol.html    

    and the expanded navigation properties are just comma separated

    so in my case it is {{BC-Instance}}/{{API-Suffix}}/{{Company}}/contacts('KT000001')?$expand=bankAccounts,shipToAddresses,contactBlocks

  • Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How can you implement multiple $expand in an API but not multilevel/cascading?

    Hi,

    you can try like this

    GET /companies({{companyId}})/salesOrders?$filter=orderDate ge 2019-05-01&$expand=paymentTerm,salesOrderLines($expand=account,item($expand=itemCategory))

    Please refer the below link,

    learn.microsoft.com/.../dynamics-rate-limits

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,698 Super User 2024 Season 2 on at
    RE: How can you implement multiple $expand in an API but not multilevel/cascading?

    Hi, Sorry I haven't tested it, hope the following helps.

    https://stackoverflow.com/questions/54560223/expand-multiple-fields-in-acumatica-rest-api-endpoint

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans