Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

API extensions and Patch calls

(0) ShareShare
ReportReport
Posted on by 25

I was able to extend the Vendor Table and Page with some custom fields, and expose these via the standard API extension methods in AL. However, using the the standard HTTP PATCH  method for Out of the box entities ( https://docs.microsoft.com/en-us/dynamics-nav/fin-graph/api/dynamics_vendor_update ), and using the endpoint for my custom API, I get an "Invalid Request Body" error.

The custom url for the endpoint is of this form: 'api.businesscentral.dynamics.com/.../vendors%{id_of_vendor})'

This is the code for the API extension. Is there special code required for an implementation of PUT or PATCH?  


page 50102 apiVendor
{
PageType = API;
Caption = 'apiVendor';
APIPublisher = 'default';
APIGroup = 'core';
APIVersion = 'v0.1';
EntityName = 'vendor';
EntitySetName = 'vendors';
SourceTable = Vendor;
DelayedInsert = true;
ODataKeyFields = Id;

layout
{
area(Content)
{
repeater(GroupName)
{

field(id; Id)
{
ApplicationArea = All;
Caption = 'Id';
}

field(legacyId; legacyId)
{
ApplicationArea = All;
Caption = 'Legacy Id';

}
field(legacyD; legacyD)
{
ApplicationArea = All;
Caption = 'Legacy D';

}

field(dType; dType)
{
ApplicationArea = All;
Caption = 'Designation Type';

}

}
}
}
}
Categories:
  • Suggested answer
    dawiehyman Profile Picture
    25 on at
    RE: API extensions and Patch calls

    The issue turned out to be that I had to determine and then supply a correlated etag in the https header of the PATCH request

  • Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: API extensions and Patch calls

    URL should be:

    {BaseURL}/v2.0/<your tenant domain>/<environment name>/api/<api publisher>/<api group>/<api version>/vendors(ID)

    and you need to pass a valid JSON object in the body.

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 Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard > Business Central forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans