Skip to main content

Notifications

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

API - Retrieve Customer Record By No Rather Than SystemId

Posted on by 2,413

Hi All

APIV2 examples use SystemId (guid) of the record to retrive by passing it as below:

GET businesscentralPrefix/companies({id})/customers({id})

GET businesscentralPrefix/companies({id})/customers({f2a5738a-44e3-ea11-bb43-000d3a2feca1})

Is there a way to create an endpoint to retrieve records by "No," such as customer number below:

GET businesscentralPrefix/companies({id})/customers({10000})

For a record in Cronus

"id": "f2a5738a-44e3-ea11-bb43-000d3a2feca1",

"number": "10000",

"displayName": "Adatum Corporation", "type": "Company", "addressLine1": "192 Market Square", "addressLine2": "", "city": "Atlanta", "state": "GA", "country": "US", "postalCode": "31772", "phoneNumber": "", "email": "robert.townes@contoso.com", "website": "", "taxLiable": true, "taxAreaId": "90196a90-44e3-ea11-bb43-000d3a2feca1", "taxAreaDisplayName": "ATLANTA, GA", "taxRegistrationNumber": "", "currencyId": "00000000-0000-0000-0000-000000000000", "currencyCode": "USD", "paymentTermsId": "04a5738a-44e3-ea11-bb43-000d3a2feca1", "shipmentMethodId": "00000000-0000-0000-0000-000000000000", "paymentMethodId": "3b196a90-44e3-ea11-bb43-000d3a2feca1", "blocked": " ", "lastModifiedDateTime": "2020-08-21T07:38:44.293Z"

Categories:
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 72,895 Super User 2024 Season 2 on at
    RE: API - Retrieve Customer Record By No Rather Than SystemId

    Hi, you can do it.

    But this need to create a new custom API page.

    For example:

    pastedimage1647561651793v1.png

    pastedimage1647561662410v2.png

    Test Code:

    page 50102 "ZY Customers"
    {
        Caption = 'ZY Customers';
        APIGroup = 'app1';
        APIPublisher = 'zy';
        APIVersion = 'v2.0';
        DelayedInsert = true;
        EntityName = 'zyCustomer';
        EntitySetName = 'zyCustomers';
        PageType = API;
        SourceTable = Customer;
    
        layout
        {
            area(content)
            {
                repeater(General)
                {
                    field(number; Rec."No.")
                    {
                        Caption = 'Customer NO.';
                    }
                    field(name; Rec.Name)
                    {
                        Caption = 'Customer Name';
                    }
                }
            }
        }
    }

    Test EndPoint: api.businesscentral.dynamics.com/.../zyCustomers('10000')

    Hope this will help.

    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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,908 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans