web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

OData / Rest: Patching an entity containing a /

(0) ShareShare
ReportReport
Posted on by 15

Does anyone have any insight into patching an entity with a / in the primary key?  For example:

ProductNumber = Product1
.../data/ProductsV2(ProductNumber='Product1')
{ "ProductName" = "NewName" }

Works just fine.

However, ProductNumber = 105E11/74N does not work.

This URL of course does not work: .../data/ProductsV2(ProductNumber='105E11/74N')

However encoding the ProductNumber doesn't allow it to be found: .../data/ProductsV2(ProductNumber='105E11%2F74N')

404 not found:
{
"Message": "No HTTP resource was found that matches the request URI '.../data/ProductsV2(ProductNumber='105E11/74N')'. No route data was found for this request."
}

Any help would be very much appreciated.

Thanks,
Tom

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: OData / Rest: Patching an entity containing a /

    Hi partner,

    Did you try "filter" condition in Odata or Rest api url?

    I tried in my instance with querying record name equals "name/2" and it worked correctly.

    1134.pastedimage1577088385733v1.png

    7750.pastedimage1577088426948v2.png

    If you use the URL to retrieve data directly, this "/" may be mistaken for a separator by the system.

    If you want to get data from an entity with some conditions like primary key or field, you could refer to web api.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api#filter-results

    Best Regards,

    Leo

  • tomhundley Profile Picture
    15 on at
    RE: OData / Rest: Patching an entity containing a /

    Filter works perfectly fine.  However, when using filter, an array is returned instead of a single element, and thus you cannot use PATCH or DELETE.  The only way to use those operations is by selecting the single resource via its primary key.  Thus, I'm stuck.  I've opened a support request with Microsoft and will update this when I figure it out.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: OData / Rest: Patching an entity containing a /

    Tom,

    As a possible workaround you can retrieve id of the record using your key and use id with a Patch to update the record. I understand that it's 2 steps operation but it should work fine.

    On the other hand opening of the ticket should cause the fix to be developed.

  • tomhundley Profile Picture
    15 on at
    RE: OData / Rest: Patching an entity containing a /

    Hey Andrew.  That would certainly be an acceptable workaround.  Is there a way to get the Id from the GET request without customizing the entity?  I'm ok customizing it, but I was hoping for some out-of-the-box functionality.  A GET on ProductV2 (for all the entities, for that matter), don't include an Id, RecId, etc.  Hopefully, I'm missing something pretty simple.

    Thanks,

    Tom

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: OData / Rest: Patching an entity containing a /

    Tom,

    I looked closer and it doesn't look like Dynamics CE endpoints. Is it AX or NAV?

  • tomhundley Profile Picture
    15 on at
    RE: OData / Rest: Patching an entity containing a /

    Ya, it's AX.  Now "D365 Supply Chain Management", to be specific.  Formally D365 Finance and Operations, formally ...

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: OData / Rest: Patching an entity containing a /

    Tom,

    I will move your thread to AX forum where you can get answer from subject matter experts.

  • André Arnaud de Calavon Profile Picture
    299,576 Super User 2025 Season 2 on at
    RE: OData / Rest: Patching an entity containing a /

    Hi Tom,

    Try to use a backslash '\' as escape character before the slash or the html number '\'

  • Verified answer
    tomhundley Profile Picture
    15 on at
    RE: OData / Rest: Patching an entity containing a /

    SOLUTION: I got an answer back from Microsoft support on this issue.  Forward slashes, backslashes, and pluses must be double escaped in the URL.

    / is %252F

    \ is %255C (I didn't test this one)

    + is %252B

    Reference: docs.microsoft.com/.../whats-new-in-aspnet-web-api-22

    Example:

    Doesn't work: .../data/ProductsV2(ProductNumber='105E11/74N')

    Doesn't work: .../data/ProductsV2(ProductNumber='105E11%2F74N')

    Works: .../data/ProductsV2(ProductNumber='105E11%252F74N')

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 839

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 839

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 228 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans