Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

how i get records from web api ?

Posted on by 775

hello, This is my web api 

function retrieveentityCollection()
{

var serverURL = window.parent.Xrm.Page.context.getClientUrl();

var req = new XMLHttpRequest();

req.open("GET", serverURL + "/api/data/v8.0/activitypointers?$select=subject,activitytypecode&$filter=statuscode eq 1", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=OData.Community.Display.V1.FormattedValue");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");

req.onreadystatechange = function()
{

if (this.readyState == 4 )
{

req.onreadystatechange = null;
if (this.status == 200)
{

var data = JSON.parse(this.response);
alert(data);

}

else
{
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send();
}

     i want to display web api records on calendar date i added web api and when i click on date it will show this alert message.

04783.Capture.PNG

but i will display full records of web api on date 

how it can be resolve?

thanx,

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: how i get records from web api ?

    Hi,

    As I see it, your object is containing the subject and activitytypecode.

    To access it you will need to write data[0].["subject"] and data[0].["activitytypecode"] or something like that.

    If you want to see all your result then you will need to loop on the index 0, i.e. go through the all length of the object 0,1,2,3,..., n

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans