Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

acessing CRM API through https

(0) ShareShare
ReportReport
Posted on by

hey guys.

i have a javascript that gets data from the CRM API, and everything goes fine when i use CRM on http.

when i access CRM through https jQuery returns error, the XMLHttpRequest Object with status: 404 and statusText: "Not Found"

when i try to access directly on the browser to https://server_address/organization_name/XRMServices/2011/OrganizationData.svc/ it returns "404 - File or directory not found."

is there a way to fix this, or a workaround, maybe on IIS? why does this happen?

thanks in advance

here is my code:

    var user = Xrm.Page.context.getUserId(); 
    var userId = user.substring(1,37);
    var serverUrl = window.location.protocol + "//" + window.location.host + "/ORGANIZATION_NAME";
    var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
    var ODATA_EntityCollection = "/SystemUserSet";
    var ODATA_Query = "(guid\'" + userId + "')";
    var ODATA_Final_url = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + ODATA_Query;

    //Calls the REST endpoint to retrieve data
    $.ajax({
        type: "GET",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: ODATA_Final_url,
        beforeSend: function (XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        success: function (data, textStatus, XmlHttpRequest) {
			
			//my code
			
		   },
        error: function (XmlHttpRequest, textStatus, errorThrown) {
            console.log(XmlHttpRequest);
            }
    });


*This post is locked for comments

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: acessing CRM API through https

    Hi,

    The configuration that you have is not supported, CRM site can have only one binding:

    technet.microsoft.com/.../hh699671.aspx

    The website will work on two bindings but the services will not. If you want to change it for web services, you can do this in deployment manager in section "Web Addresses" in properties

  • RE: acessing CRM API through https

    should i enable it? i still want people to be able to acess the CRM through https.

  • RE: acessing CRM API through https

    Hi Pawel,

    CRM is working on both http and https.

    isn't there a way to make the API available trough both ?

  • abhishek_255 Profile Picture
    abhishek_255 1,612 on at
    RE: acessing CRM API through https

    It seems like HTTPS binding is not enabled on IIS.

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: acessing CRM API through https

    Hi,

    Is your CRM working on http or https? If it's on http, then API will also be on http

  • RE: acessing CRM API through https

    hi Guido, thanks for your reply,

    i didn't know that command existed, thanks, but it works perfectly on http, and i've checked if the URL is correct, so.. any other ideas?

    maybe is there an option on IIS to allow https calls to the API ?

    regards,

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans