Search code examples
node.jstypescriptxmlhttprequestdynamics-crm

HTTP GET response says missing field Node XmlHttpRequest


I'm trying to make a get call to Dynamics CRM via the WebApi with the code below However I get the "Required Field "EntityName" is missing" response. How can I add it correctly? if I include it in the send() as a parameter it gets wiped and won't be sent with it.

I'm relatively new to this so I don't know what I'm doing wrong.

Code:

let url = this._data.OrgInfo.CrmUrl + "/api/data/v" + this._data.OrgInfo.ApiVersion + "/RetrieveEntityRibbon?EntityName=account";

var xmlHttpRequest = require('xhr2');
var req = new xmlHttpRequest();
req.open("GET", url, true);
setRequestHeaders()
req.addEventListener("load", function() {
    let result = JSON.parse(req.response);
             
}, false);
req.send();
});


Solution

  • This should work, but verify it on your end pls.

    let url = this._data.OrgInfo.CrmUrl + "/api/data/v" + this._data.OrgInfo.ApiVersion + "/RetrieveEntityRibbon(EntityName='account',RibbonLocationFilter='All')";