Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Odata - Update failed when trying to update entity via Postman (404 resource not found)

Posted on by 14
Hi,
 
We are working with a custom built entity called CC_PartsTraderTransaction which contains invoice lines in D365. I want to update one field in this entity known as PTInvoice using the PATCH verb. An example of a Get call for this CC_PartsTraderTransaction entity returns:
 
 
The defined key for this entity is:
 
 
When I perform a PATCH to update the PTInvoice value to be Yes for a specific item I get a 404 resource not found and yet I know that this invoice exists. Why could this be the case ? What is wrong with the URL construct I am using ?
 
 
Secondly, is there a way to update multiple invoices in the same ODATA API call, ie. the URL does not contain the params of the row to update but the request body contains an array of invoice lines with the required key entity data specified for each row to update.
  • Christine B Profile Picture
    Christine B 14 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hey layan, I'm trying to verify your answer but I get a 403. I'm afraid I can't verify it. Will keep trying though.
  • Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi,

    I'm glad your issue is fixed :)

    Please don't forget to verify the answers that solved your issue.
  • Christine B Profile Picture
    Christine B 14 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hey Layan, fantastic that worked. Removing the single quotation from the URL and just having the attribute to update in the request body. Thank you.
  • Verified answer
    Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi CB,

    After you changed the body format, I think you also need to remove the single quotation for the InvoiceDate in the URL:
    https://xxxxxxxxxxx.dynamics.com/data/CC_PartsTraderTransaction(dataAreaId='sk',Voucher='APIMP000032562',InvoiceNumber='66504331',InvoiceDate=2019-07-27T12:00:00Z)?cross-company=true

    give it a try and let us know
    ​​​​​​​
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.
  • Suggested answer
    Anthony Blake Profile Picture
    Anthony Blake 2,184 Super User 2024 Season 2 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi,
     
    Take a look at the customer PATCH example here in case it helps, its a working example from a standard table:
     
     
    To answer your second point, you can send multiple OData requests at once, but not as a simple array. The method is using OData $batch, which involves sending an array of requests rather than an array of records.
     
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi,
    You should provide GUID of the record in your patch request:
    You can refer to this blog for detailed steps:
  • Christine B Profile Picture
    Christine B 14 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi Layan,
     
     
    However, I still get the http 404 response.
  • Verified answer
    Layan Jwei Profile Picture
    Layan Jwei 7,347 Super User 2024 Season 2 on at
    Odata - Update failed when trying to update entity via Postman (404 resource not found)
    Hi,

    I think it's because the body format is wrong. Try to put the body like this:
     
    {
        "PTInvoice""Yes"
    }


    For example, if i want to update the customer currency, here's what i would do with PATCH:
    url/data/CustomersV3(CustomerAccount='xx',dataAreaId='yy')
     
    and the body will be like this:
    {
        "SalesCurrencyCode""USD"
    }

    ​​​​​​​

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.

     

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans