Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

acessing CRM API through https

$
0
0

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);
            }
    });



Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>