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 :
Microsoft Dynamics CRM (Archived)

Retrieve entity metadata

(0) ShareShare
ReportReport
Posted on by

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

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    What type of authentication and deployment are you using?

    OnPrem/Online? Claims/IFD?

  • Community Member Profile Picture
    on at

    Using

    365 update 2.1 (8.2.1.176) OnPrem

    IFD with Federation Server Authentication

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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
    on at

    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 - MVP Profile Picture
    30,190 Moderator on at

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

    For example, does this work:

    org.domain.com/.../accounts

  • tw0sh3ds Profile Picture
    5,600 on at

    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.

  • Community Member Profile Picture
    on at

    If I run the above query on Accounts

    I do get the correct response.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Suggested answer
    SergiiChvyr Profile Picture
    on at

    Hi,

    change your query like this:

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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans