Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Understanding API Queries

(0) ShareShare
ReportReport
Posted on by

Hello

I am super confused about how to work an api query or page table. I understand how to get all of the data from my custom api page and query, but I am trying to have an input that will only get one row of the table. Right now, I am entering a No in the header (what material I want the information for). The code is below

pastedimage1655323281439v2.png

What do I need to do to filter this so I only get a specific input that is specified in the header???

  • Verified answer
    YUN ZHU Profile Picture
    85,670 Super User 2025 Season 1 on at
    RE: Understanding API Queries

    Hi, If you read Query data in AL, you can use the following method to filter.

    Query.SetFilter(Any, Text [, Any,...]) Method: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/queryinstance-setfilter-method

    Query.SetRange(Any [, Any] [, Any]) Method: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/queryinstance-setrange-method

    For example,

    pastedimage1655422795648v2.png

    If you're in an API, this requires the API's filter method.

    For example,

    pastedimage1655422971539v3.png

    api.businesscentral.dynamics.com/.../VendorLedgerEntries?$filter=Vendor_No eq '20000'

    pastedimage1655423050222v4.png

    More details: https://yzhums.com/6117/#toc8 (please replace the single quotation marks)

    pastedimage1655423081873v5.png

    Hope this helps.

    Thanks.

    ZHU

  • Community Member Profile Picture
    on at
    RE: Understanding API Queries

    That is extremely helpful! Do you know where the inputs go when calling a query? Like if I want to filter based on a variable that is being passed in the header? (ex. a specific item that is subject to change between calls)

  • Suggested answer
    YUN ZHU Profile Picture
    85,670 Super User 2025 Season 1 on at
    RE: Understanding API Queries

    Hi, If you want to filter the query results directly, you can use the DataItemTableFilter Property.

    More details: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-dataitemtablefilter-property

    For example:

    pastedimage1655339314009v1.png

    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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans