How do I connect to the organization data service of Dynamics CRM with a node.js application?
I do not have web api in developer resource, so how to get data with organization data service?
...

How do I connect to the organization data service of Dynamics CRM with a node.js application?
I do not have web api in developer resource, so how to get data with organization data service?
...

On
Am sharing the github code sample from this blog.
This uses OrganizationData service from Node.js script to pull FullName of Contacts (ContactSet).
// Set the headers for the call to CRM
var headers = {
'Authorization': 'Bearer ' + sess.access_token, //send the oauth access token to authenticate
'Accept': 'application/json' //tell CRM to send json data back
}
//configure the CRM odata request
var options = {
host : crm_host,
port : crm_port,
path : '/XRMServices/2011/OrganizationData.svc/ContactSet?$select=FullName', //hardcoded to select just the contact name
method : 'GET',
rejectUnauthorized: false,//to allow for self-signed SSL certificates - use at your own risk!!!
headers : headers //set in the previous step
};
var reqGet = https.request(options, function(resGet) {
//should do something here if we get 'www-authenticate': 'Bearer error' response headers
//console.log("headers: ", resGet.headers);
resGet.on('data', function(d) {
//console.info('raw response: ' + d);
var json = JSON.parse(d);
var records = json.d.results;
//console.info('results: ' + JSON.stringify(records));
for (var i in records) {
res.write(records[i].FullName + '<br />');
}
res.write('</body>');
res.write('</html>');
res.end();
});
});
reqGet.end();
//handle errors
reqGet.on('error', function(e) {
console.error(e);
});
If you are using CRM 2016 or later Use the Microsoft Dynamics 365 Web API
If you are using CRM 2015 or earlier use the Organization Service (aka SOAP endpoint).