Skip to main content

Notifications

Announcements

No record found.

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

Cannot update Item journal through Odata

Posted on by 30

I have published a web service for Item Journal[object Id: 40]. My intention is to update Item journal's quantity field through Odata service. The API is giving response in GET method, but if I use PUT method to update the quantity field it is throwing "Bad request". Below are the details of my request

URI: http://localhost:5467/Cronus42/OData/Company('CRONUS%20India%20Ltd.')/ItemJournalLines(Journal_Template_Name='ITEM',Journal_Batch_Name='SA-7',Line_No=10000)

Request Headers: Accept:application/json

Request Body: {"Quantity": "10"}

Can any one suggest me the solution.

Thank you.

  • RE: Cannot update Item journal through Odata

    How do you specify the Company in the URL? By name or ID? It should work only with ID I think. Can you try that instead?

  • Prashant_Kumar Profile Picture
    Prashant_Kumar 30 on at
    RE: Cannot update Item journal through Odata

    I have changed it to PATCH method and added a new header "If-Match". Now the response has 400 Bad request error along with below message. I am specifying the company name in my URL.

    Error Message: "Cannot process the request because the default Microsoft Dynamics NAV company cannot be found. You can specify a default company in the service configuration file, or specify one for each tenant, or you can add a query string in the form of \"company=[name]\". You can see the available companies by accessing the default OData web service, Company. For more information, see \"OData Web Services\" in Help."

  • Suggested answer
    RE: Cannot update Item journal through Odata

    Hi,

    Can you try to use PATCH method?

    I had seen a similar issue with the Unit Price for Job Planning Lines and were able to resolve it by using the Job_No, Job_Task_No, and Line_No in the query like this to find the newly created planning lines:

    nav.contoso.com:7048/.../Job_Planning_Lines(Job_No='TEST-0004',Job_Task_No='100',Line_No=10000)

    Then we used a PATCH method on that URL to input just unit price like this:

    {

     "Unit_Price": 10

    }

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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans