Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
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 4,742 Super User 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 4,742 Super User 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 1,223 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 4,742 Super User 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.

     

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,835 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,526 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans