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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Performing updates using alternate key in Dynamics 365 WebAPI

(0) ShareShare
ReportReport
Posted on by 25

Can anyone help , as I believe someone has already faced the issue I'm having.

I have a custom entity (alssc_anglesector) with an alternate key (alssc_name)

“alssc_ANGLESector@odata.bind”: “/alssc_anglesectors(alssc_name=’Air’)”, “

alssc_ANGLESector@odata.bind”: “/alssc_anglesectors(alssc_name=’Water Auth/Company’)”,

when I create an account and use the first bind with “Air” it works fine, while when using the second “Auth/Company” I got the response

“message”: “Bad Request – Error in query syntax.”, “type”: “Microsoft.OData.ODataException”, “stacktrace”: ” at Microsoft.OData.UriParser.ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(String segmentText, String& identifier, String& parenthesisExpression)

I have also tried to encode it

"alssc_ANGLESector@odata.bind": "/alssc_anglesectors(alssc_name=\u0027Water Auth\u002FCompany\u0027)",

but he end result was the same.

I’m not being able to overcome this, Any ideias / suggestions ?

Could it be a Bug in D365 API WebApi ?

Best regards, Manuel

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Try to replace 

    ’Water Auth/Company’

    with 

    ’Water Auth%2fCompany’

    according to following post - https://stackoverflow.com/questions/43139878/webapi-with-backslash-2f-in-id-parameter-causes-404-not-found

  • mesteves Profile Picture
    25 on at

    Thanks a33ik,

    I have tried, and the result is the same :( 

    "alssc_ANGLESector@odata.bind": "/alssc_anglesectors(alssc_name='Water Auth%2fCompany')",
    "message": "Bad Request - Error in query syntax.",

    I'm starting to really believe that is a webApi issue. How can I have someone from MSFT to take a look and confirm this problem ? 

    Best regards, 

    Manuel

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Manuel,

    The best way is to open a ticket with Microsoft and ask for support - mbs.microsoft.com/.../CRMSupport

  • Suggested answer
    Aditya Profile Picture
    260 on at

    Hi Mesteves,

    I am not sure how alternate keys are assigned in D365

    but I know that @odata.bind can be used for the record id as shown below :-

         var data={         "alssc_anglesectorid@odata.bind": "/alssc_anglesectors(" + result[_alssc_anglesectorid_value] + ")"}

    or

    newObj["alssc_anglesectorid@odata.bind"] = "/alssc_anglesectors(" + result["_alssc_anglesectorid_value"] + ")";

  • mesteves Profile Picture
    25 on at

    Thanks Aditya ,

    However in a integration scenario with external applications, it harder to do it by Id, we would need to know all the possible values for the Id's.

    Thanks anyway, it's an option to keep open :) 

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Can you try below syntax and see if it works.

    Water%20Auth%2FCompany

    If found helpful, Please mark my answer verified.

  • mesteves Profile Picture
    25 on at

    Hi Bipin Kumar

    Thanks for the suggestion. The same reply is returned...

    "alssc_AcmeSector@odata.bind""/alssc_Acmesectors(alssc_name='Water%20Auth%2FCompany')",
    "innererror": {
                "message""Bad Request - Error in query syntax.",
                "type""Microsoft.OData.ODataException",
                "stacktrace""   at Microsoft.OData.UriParser.ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression
    I'll customize the entities with one extra column (code) and will  go that way... but this seems to be some sort of bug in the Api....
    Thanks,
    Manuel
  • Verified answer
    Alejandro Serdan Profile Picture
    Microsoft Employee on at

    Hi!

    The request is unsupported: 

    Unicode characters in key value

    If the data within a field that is used in an alternate key will contain one of the following characters <,>,*,%,&,:,/,\\ then update or upsert (PATCH) actions will not work.

    If you only need uniqueness then this approach will work, but if you need to use these keys as part of data integration then it is best to create the key on fields that won't have data with these characters.

    https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/define-alternate-keys-reference-records#unicode-characters-in-key-value

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 73 Super User 2026 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#3
11manish Profile Picture

11manish 50

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans