Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Error 500 on retrieveMultipleRequest - Dynamics Web Api

Posted on by Microsoft Employee

Hi

I having a problem when I make a retrieveMultipleRequest to Dynamics Web Api.

Token it's ok, in fact, I make a WhoIAm and works smooth.

------------------------

var resource = 'THE_ORG.crm4.dynamics.com/api/data/v9.0';

var dynamicsWebApi = new DynamicsWebApi({
    webApiUrl: resource,
    onTokenRefresh: TOKEN_CALLBACK
});

var request = {
    collection: "contacts",
    select: ["fullname", "firstname","lastname","emailaddress1","contactid","mobilephone"],
    filter: "mobilephone eq '"+ phone_number +"'",
    maxPageSize: 5,
    count: true
};
   
//perform a multiple records retrieve operation
dynamicsWebApi.retrieveMultipleRequest(request).then(function (response) {

    //SOME CODE

}).catch(function (error){
    //catch an error
    console.log('Houston... We have a problem');
    console.log(error);
    callback(null,'No Record');
});

------------------------

In fact, I can't execute the rest of the code

What I'm doing wrong?

The error code is not descriptive at all


------------------------

{

  message: 'Unexpected Error',
  status: 500,
  statusMessage: 'Internal Server Error',
  headers: '[Object]'

}

------------------------

Any ideas?

Kind regards

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error 500 on retrieveMultipleRequest - Dynamics Web Api

    Yes, works well.

    The problem was the end of url string, must end with "/", that's all.

    Really useful the documentation.

    Thanks a lot.

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Error 500 on retrieveMultipleRequest - Dynamics Web Api

    Great, is it working now?

    Also, if you are accessing WebAPI outside from the CRM (like NodeJS), you ca query the data by using HTTP GET on the entityset.

    For example:

    GET [Organization URI]/api/data/v9.1/contacts?$select=fullname,firstname,lastname,emailaddress1,contactid,mobilephone&$filter=mobilephone eq '1100111111'

    Here is official documentation with examples:

    https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/query-data-web-api

    You can also configure postman to test your queries:

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/webapi/use-postman-web-api

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error 500 on retrieveMultipleRequest - Dynamics Web Api

    It's dumb one... The URL on webApiUrl must en with '/'

    The right Url must be

    'THE_ORG.crm4.dynamics.com/api/data/v9.0/'

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans