Skip to main content

Notifications

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

Create own API with filtered data

Posted on by 15

Hi everyone!

I'd like to create an own API for service quotations and service orders. They are written in the same table (Service Header, 5900), so I would like to create two APIs for this table and filter it for quotes and orders.

I'm not an expert in AL so I don't know how to do that. I've this code snippet where I think there must be set a filter.

field(documentType; Rec."Document Type")
                {
                    Caption = 'Document Type';
                }

Thanks for helping!

  • fherrscher Profile Picture
    fherrscher 15 on at
    RE: Create own API with filtered data

    Thank you very much!

    That is what I was searching for.

  • Verified answer
    liki Profile Picture
    liki 50 on at
    RE: Create own API with filtered data

    Add in API page settings

    -> SourceTableView = where("Document Type" = filter(Quote)) and for another -> "Document Type" = FILTER(Order));

    learn.microsoft.com/.../devenv-sourcetableview-pages-property

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Create own API with filtered data

    You can follow below link, which will guide to put the filters in API

    learn.microsoft.com/.../use-filter-expressions-in-odata-uris

  • fherrscher Profile Picture
    fherrscher 15 on at
    RE: Create own API with filtered data

    Hi, thanks for your response!

    Sorry, I was a bit imprecise.

    I know how to create a API page with AL, but I just don't know how to filter data in the API page.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Create own API with filtered data

    Hi,

    you need to create a API page for that, for more information and lean you can follow the below link

    learn.microsoft.com/.../devenv-api-pagetype

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans