Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer
Posted on by 56
Hello,
 
I have used ODATA service to get details of 'NoSeriesLines' of VEND , it is working fine.
 
I want to update the Last_No_Used in NoSeriesLines (as shown in highlighted image) using below code
 
                string updateUrl = "https://api.businesscentral.dynamics.com/v2.0/acb64e3567a44d24e/Sandbox/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/NoSeriesLines?$filter=Series_Code eq 'VEND'";        
    
// Construct the HTTP request
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateUrl);
request.ContentType = "application/json";
request.Method = "PATCH"; // Use PATCH for updating records
// Add authorization header
request.Headers.Add("Authorization", "Bearer " + authToken);
// JSON payload for updating Last_No_Used
string jsonPayload = @"
{
    ""Last_No_Used"": Last_No_Used
}";
 
 
but, it is giving error of 'The remote server returned an error: (405) Method Not Allowed.', as per error looks like ODATA web service I am using for update record is not correct.
 
Please help me to find the correct ODATA webservice page to update the records in NoSeries in BC.
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,933 Super User 2024 Season 2 on at
    ve
    Hi, It looks like you published this page directly to the Web Service
    Unfortunately, this field is a variable and Editable is false, so it cannot be edited.
     
    You can choose to create a new list page and publish it to the Web Service, or create an API page.
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    VaHiX Profile Picture
    VaHiX 1,331 on at
    ve
    Ensure that the OData service endpoint supports the HTTP method you’re using. In Business Central, certain endpoints might only support GET and POST methods, not PATCH or PUT.
     
     

    ** Please don't forget to close up the thread here by Like and verify it as an answer if it is helpful **

     

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans