Addressing UTCDateTime field in data entity URL for patch method in postman ~ D365FO

286 views Asked by At

Greetings for the day!

I'm trying to update (i.e Patch method) PartyLocationPostalAddressesV2 entity via postman for integration purpose. It has one key which contains three fields in it [PartyNumber, LocationID, ValidFrom]. I need to address the URL.

I'm trying like:

D365EnvironmentAddress/.../PartyLocationPostalAddressesV2(dataAreaId='206'PartyNumber='000219507'LocationId='L000007558'ValidFrom='2021-10-20T06:54:04Z')

But I'm getting this error:

"Message": "No HTTP resource was found that matches the request URI '">D365EnvironmentAddress/.../PartyLocationPostalAddressesV2(dataAreaId='206'PartyNumber='000219507'LocationId='L000007558'ValidFrom=2021-10-20T06:54:04Z)'. No route data was found for this request."

I've tried with filter instead of addressing,

D365EnvironmentAddress/.../PartyLocationPostalAddressesV2 PartyNumber eq '000219507' and LocationId eq 'L000007558' and ValidFrom eq 2021-10-20T06:54:04Z

and it's working but for updating a field we need to use addressing only as per my knowledge so please help me with it. I know I need to change something around validfrom field. But couldn't find it out. Because while using filter, I got the same error so tried with the single quotes removed for validFrom field it worked. I tried the same for addressing but I'm missing something. Please guide me through it. Thanks in advance! I've attached screenshots too.

This one while using filter query

This one while using addressing

1

There are 1 answers

3
FH-Inway On

I got this working on my end on a 10.0.20 environment with Contoso demo data.

Here are some of the issues I ran into that I also see in the example request of the question:

  • The request in the adressing format includes the dataAreaId. This is not needed since the data of the PartyLocationPostalAddressesV2 entity is not company specific. Including dataAreaId with the adressing format leads to the described issue for these entities.
  • As in the request with the filter, the value for ValidFrom should not be in quotes. This also results in the described issue.

So make sure both of those are fixed before trying again.

For the record, this is GET request that worked for me:

{{D365EnvironmentAddress}}/data/PartyLocationPostalAddressesV2(PartyNumber='000000002',LocationId='000000002',ValidFrom=2013-07-02T18:38:16Z)

The PATCH request looks the same, I used the following payload to update the street successfully (make sure the payload content type is set to application/json):

{
    "Street": "123 Third Street"
}

Note that the PATCH request will return a 204 No Content status code, but the data gets updated.

Finally, here is the JSON data of the record I was working with as returned by the GET request:

{
    "@odata.context": "https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/$metadata#PartyLocationPostalAddressesV2/$entity",
    "@odata.etag": "W/\"JzAsNTYzNzE0NDgyNjszNjMxNDk1NjIsNTYzNzE0NDgyNic=\"",
    "PartyNumber": "000000002",
    "LocationId": "000000002",
    "ValidFrom": "2013-07-02T18:38:16Z",
    "Address": "123 Third Street\nBaldwin City, KS 66006\nUSA",
    "IsPrivate": "No",
    "Description": "Head Office",
    "IsPrimary": "Yes",
    "IsPrivatePostalAddress": "No",
    "IsRoleDelivery": "No",
    "IsPrimaryTaxRegistration": "Yes",
    "CityInKana": "",
    "ZipCode": "66006",
    "IsRoleBusiness": "No",
    "PostBox": "",
    "DunsNumber": "",
    "Apartment_RU": "",
    "DistrictName": "",
    "BuildingCompliment": "",
    "CountryRegionISOCode": "US",
    "StreetInKana": "",
    "CountryRegionId": "USA",
    "IsLocationOwner": "Yes",
    "TimeZone": null,
    "ValidTo": "2154-12-31T23:59:59Z",
    "Longitude": 0,
    "Building_RU": "",
    "County": "",
    "StreetNumber": "",
    "Latitude": 0,
    "IsRoleHome": "No",
    "IsRoleInvoice": "No",
    "City": "Baldwin City",
    "AttentionToAddressLine": "",
    "Roles": "Business",
    "Street": "123 Third Street",
    "State": "KS"
}