Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Issue due to header in ajax script

Posted on by 135

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

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