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"
Hi, you can do it.
But this need to create a new custom API page.
For example:
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,101 Super User 2024 Season 2
Martin Dráb 229,908 Most Valuable Professional
nmaenpaa 101,156