Skip to main content

Notifications

Announcements

No record found.

Business Central forum
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?

Categories:
  • 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 20,991 Super User 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 64,134 Super User 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans