web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

Proper way to use filters with business central API in On-Prem multitenant environment.

(0) ShareShare
ReportReport
Posted on by 25

Greetings to Everyone.

I am having trouble figuring out the proper usage of filter with OnPrem Business Central Api. We have used multi-tenant deployment.

This is working
http://localhost:7048/gasorgn/api/BizNP/biobizapi/v1.0/companies(3530cd87-f0b2-ec11-9111-82e8be684e31)/generalledgerentries?tenant=gasmaster

But while using the filter this way, it is not working
http://localhost:7048/gasorgn/api/BizNP/biobizapi/v1.0/companies(3530cd87-f0b2-ec11-9111-82e8be684e31)/generalledgerentries?$filter=PostingDate eq 2022-03-15?tenant=gasmaster

Likewise, use of expand on standard api also does not work
http://localhost:7048/gasorgn/api/v2.0/companies(3530cd87-f0b2-ec11-9111-82e8be684e31)/customers?$expand=contactsInformation?tenant=gasmaster

They Give the following message

{"error":{"code":"Authentication_InvalidCredentials","message":"Web service call failed because user could not be authenticated or authorized. CorrelationId: ae68c640-ec54-43f2-90b9-27c80fdb1f45."}}


I would be grateful for any help or suggestions.

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    89,835 Super User 2025 Season 2 on at
    RE: Proper way to use filters with business central API in On-Prem multitenant environment.

    Hi, I used to sort out the Filters method in APIs.
    Hope the below will help you too.

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

    Operator Description Example
    Comparison operators    
    eq  Equal ?$filter=category eq 'Expense'
    ne  Not equal ?$filter=unitPrice ne 0
    gt Greater than ?$filter=unitPrice gt 1000
    ge Greater than or equal ?$filter=unitPrice ge 1000
    lt Less than ?$filter=unitPrice lt 1000
    le Less than or equal ?$filter=unitPrice le 1000
    Logical operators    
    and Logical and ?$filter=number ge '50000' and number lt '60000'
    or Logical or ?$filter=category eq 'Expense' or category eq 'Income'
    not Logical negation Not supported
    Grouping    
    () Precendence grouping ?$filter=(category eq 'Expense' or category eq 'Income') and (number ge '40000' and number lt '50000')
    Comparison operators    
    contains Search for substring ?$filter=contains(displayName, 'red')
    endswith Test if first string ends with second string ?$filter=endswith(email,'contoso.com')
    startswith Test if first string starts with second string ?$filter=startswith(email,'aj')
    concat Returns a string that appends the second paramter to the first Not supported
  • Verified answer
    Roshan Dangol Profile Picture
    25 on at
    RE: Proper way to use filters with business central API in On-Prem multitenant environment.

    After some research I found out the correct to embed both filter and tenant both at once to API url is through & operator instead of ? operator that I used in my question. So, the correct url would be:

    http://localhost:7048/gasorgn/api/BizNP/biobizapi/v1.0/companies(3530cd87-f0b2-ec11-9111-82e8be684e31)/generalledgerentries?$filter=PostingDate eq 2022-03-15&tenant=gasmaster

  • Suggested answer
    Andy Sather Profile Picture
    on at
    RE: Proper way to use filters with business central API in On-Prem multitenant environment.

    Hello,

    If you don't get further responses to this issue, you may want to raise a support request to Microsoft support via your CSP / Partner.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans