Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

ve

(2) ShareShare
ReportReport
Posted on by 66
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.
  • Suggested answer
    gdrenteria Profile Picture
    gdrenteria 12,290 Most Valuable Professional on at
  • Suggested answer
    Ramiz Profile Picture
    Ramiz 344 on at
    ve
    Hi,

    Hope this helps.

    https://yzhums.com/38278/
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,036 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 3,119 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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans