Hello Folks,
I'm facing error while passing the mandatory header in the ajaxcall using javascript.
When i exclude the header i get headers missing error if i include the header i get 500 internal server error in the logs (errors": [{"message": "Unable to match incoming request to an operation.", "reason": "OperationNotFound", "section": "backend", "source": "configuration"}]})
Any suggestions? or any other way to call the Async API url?
if (typeof ($) === 'undefined') {
$ = parent.$;
jQuery = parent.jQuery;
}
function submit(selectedIds) {
if (selectedIds != null && selectedIds != "") {
Xrm.WebApi.retrieveRecord("profile", selectedIds, "?$select=name").then(
function success(result) {
var name=result.name;
var urlPath = "AZUREAPIURL" + imsi ;
var subscriptionKey = "XXXXXXXXXXXXX";
var NewDate=new Date().toUTCString();
var xRequestID = generateUUID();
$.ajax({
headers: {
"X-Request-ID" : xRequestID,
"Date": NewDate
},
url: urlPath + "?api-key=" + subscriptionKey,
type: "GET",
dataType: "json",
async: true,
crossDomain: true,
success: function (data, textStatus, xhr) {
return JSHelper.toJson(data);
},
error: function () {}
})
.done(function (data, status, jqxhr) {});
},
function (error) {}
);
}
}
Regards,
Hima