Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

OData REST API Patch issue

(1) ShareShare
ReportReport
Posted on by 25
Hi,
 
I'm having an issue patching a customers address through Odata in D365 F&O.
 
All of the below is done through Postman. All with system administrator rights.
 
I have created an address for a customer using the PartyLocationPostalAddressesSalesTaxGroupV2 entity with no issue.
 
I get a 200 status code from D365 and everything looks correct.
 
Later, when I try to patch the same address I do as follows:
 
1) Use the sam entity to GET the LocationId, ValidFrom and PartyNumber from the address
2) Make the patch call with the changes in the body. Values are dummy data, but format and datatypes are the same. Values all come from the previous GET call
- URL PATCH: <dynamicsUrl>/data/PartyLocationPostalAddressesSalesTaxGroupV2(PartyNumber='1234',LocationId='000005001',ValidFrom=2024-03-20T12:00:00Z)?cross-company=true
- body: {/Street/: /New Street 1/}
 
And I then get this from D365:
{
    /Message/: /No HTTP resource was found that matches the request URI '<dynamicsUrl>/data/PartyLocationPostalAddressesSalesTaxGroupV2(PartyNumber='1234',LocationId='000005001',ValidFrom=2024-03-20T12:00:00Z)?cross-company=true'. No route data was found for this request./
}
 
What am I doing wrong here?
 
 
 
 
  • Verified answer
    TechLogic Profile Picture
    TechLogic 25 on at
    OData REST API Patch issue
    The solution has been found
     
    It's required to use "PartyLocationPostalAddressesV2" when patching records in the "PartyLocationPostalAddressesSalesTaxGroupV2" entity.
     
    So with this call:
     
    - URL POST: <dynamicsUrl>/data/PartyLocationPostalAddressesSalesTaxGroupV2
    - body: {<address fields>}
    the address is created.
     
    But when I want to patch the same address I need to do this 
    - URL PATCH: <dynamicsUrl>/data/PartyLocationPostalAddressesV2(PartyNumber='1234',LocationId='000005001',ValidFrom=2024-03-20T12:00:00Z)?cross-company=true
    - body: {/Street/: /New Street 1/}
     
    I haven't seen this documented any where so the solution were found by bright heads brute forcing a lot of different calls.
  • TechLogic Profile Picture
    TechLogic 25 on at
    OData REST API Patch issue
    Adding the "LegalEntity" as part of the parameters does only change how the error response is formatted. Now it looks like this:
     
    To my understanding the PartyLocationPostalAddressesSalesTaxGroupV2 is a global entity. I see that there is a LegalEntity field but it is not used. When I got to the "excel workbook designer" inside of D365F&O I do not see the LegalEntity as part of the key.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,599 Super User 2024 Season 2 on at
    OData REST API Patch issue
    Hi,
     
    You don't add the Legal Entity to (PartyNumber='1234',LocationId='000005001',ValidFrom=2024-03-20T12:00:00Z), The Legal entity is part of the entity Key. Try it.


     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 10,863 Super User 2024 Season 2 on at
    OData REST API Patch issue
    Hi,
     
    I hope this can help you.
     
     
    Best regards,
    Mohamed Amine MAHMOUDI

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,476 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans