Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Retrieve entity metadata

Posted on by Microsoft Employee

I have an error when querying Entity Metadata using the Web API

Executing the Query

https://<domain>/<org>/api/data/v8.2/EntityDefinitions(LogicalName='contact')

Gives me the following error.

"error":{
    "code":"","message":"An unexpected error occurred.","innererror":{
      "message":"An unexpected error occurred.","type":"System.ServiceModel.FaultException`1 ....

If I look at the trace messages i get the following

>FileExists ~/api/data returning False.

>DirectoryExists ~/api/data returning False

I have checked service root ULR and made sure I am using the FQDN in crm deployment utility

If i run a standard Query like this

https://<domain>/<org>/api/data/v8.2/contacts?$select=fullname&$top=1

I get the correct response

{
  "@odata.context":"https://<domain>/<org>/api/data/v8.2/$metadata#contacts(fullname)","value":[
    {
      "@odata.etag":"W/\"23436269\"","fullname":"xxxxxxx","contactid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  ]
}





*This post is locked for comments

  • Suggested answer
    SergiiChvyr Profile Picture
    SergiiChvyr on at
    RE: Retrieve entity metadata

    Hi,

    change your query like this:

    https://<domain>/<org>/api/data/v8.2/EntityDefinitions?$filter=LogicalName eq 'contact'

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Retrieve entity metadata

    Can you please provide the full error message when you run this:

    https://<domain>/<org>/api/data/v8.2/EntityDefinitions(LogicalName='contact')

    Just want to see if missing something.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve entity metadata

    If I run the above query on Accounts

    I do get the correct response.

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Retrieve entity metadata

    Usually this error is caused by bad IFD/Claims configuration. Can you check if the services work correctly if you disable IFD and Claims (in Deployment Manager)? If it does not work even without IFD/Claims then I'm pretty sure that your installation is crashed and you will probably need to reinstall CRM.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Retrieve entity metadata

    Are you able to access other API methods, besides that Entity Definitions?

    For example, does this work:

    org.domain.com/.../accounts

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve entity metadata

    Hi,

    I have tried with and without the org name from internal and external connections.

    In all these scenarios I get the same result.

    Personally I think there is something wrong with the Web Services of this installation but how do I check or verify that this is the case..

    If I use XRMToolbox with FetchXML Builder when trying select additional attributes to add to the Query i also get a Unexpected error.

    I also installed CRM REST Builder as a solution but opening the solution also gives me an unexpected error occurred.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Retrieve entity metadata

    Hi,

    If you are using IFD, why do you have the org after domain:

    Try using:

    myorg.contoso.com/.../EntityDefinitions(LogicalName='contact')

    Sometimes using the claims url when you have IFD configured has been known to cause issues.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve entity metadata

    Using

    365 update 2.1 (8.2.1.176) OnPrem

    IFD with Federation Server Authentication

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Retrieve entity metadata

    What type of authentication and deployment are you using?

    OnPrem/Online? Claims/IFD?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans