locked
Can we access Dynamics CRM online data in other application using REST in javascript/jquery RRS feed

  • Question

  • HI,

    I have a CRM online application.

    I need to access CRM data in other application using javascript/jquery .

    How we can authenticate and access CRM data in other application ? (using REST)


    Please remember to click 'Mark as Answer' on the post that helps you or "Vote As Helpful"

    Tuesday, June 18, 2013 8:59 AM

Answers

  • I believe its not possible, you can't access it externally.

    Authentication is only possible within the application.

    Use of the REST endpoint is limited to JScript libraries or Silverlight web resources.

    For Reference please check this: Use the REST Endpoint for Web Resources




    • Proposed as answer by jattscorpion Tuesday, June 18, 2013 9:09 AM
    • Edited by jattscorpion Tuesday, June 18, 2013 9:16 AM
    • Unproposed as answer by Yesh Agrawal Tuesday, June 18, 2013 9:35 AM
    • Proposed as answer by jattscorpion Tuesday, June 18, 2013 9:52 AM
    • Marked as answer by Yesh Agrawal Tuesday, June 18, 2013 12:00 PM
    Tuesday, June 18, 2013 9:09 AM

All replies

  • I believe its not possible, you can't access it externally.

    Authentication is only possible within the application.

    Use of the REST endpoint is limited to JScript libraries or Silverlight web resources.

    For Reference please check this: Use the REST Endpoint for Web Resources




    • Proposed as answer by jattscorpion Tuesday, June 18, 2013 9:09 AM
    • Edited by jattscorpion Tuesday, June 18, 2013 9:16 AM
    • Unproposed as answer by Yesh Agrawal Tuesday, June 18, 2013 9:35 AM
    • Proposed as answer by jattscorpion Tuesday, June 18, 2013 9:52 AM
    • Marked as answer by Yesh Agrawal Tuesday, June 18, 2013 12:00 PM
    Tuesday, June 18, 2013 9:09 AM
  • Using WCF service we can connect to CRM data from other application.

    ALL i want is to access the same using javascript/jquery.

    Can we ?


    Please remember to click 'Mark as Answer' on the post that helps you or "Vote As Helpful"

    Tuesday, June 18, 2013 9:38 AM
  • Yes, you can connect to CRM from other application with WCF. But REST is only supported with in the same application. 

    If you want to access CRM from outside than you need to make a WCF call using Organization Service.

    To consume the WCF from JQuery, please check the links below:

    http://www.codeproject.com/Articles/132809/Calling-WCF-Services-using-jQuery

    http://stackoverflow.com/questions/14586328/consuming-a-wcf-service-in-jquery-via-ajax-call-in-a-different-project-cross-do

    http://forum.jquery.com/topic/jquery-ajax-calling-wcf-asp-net


    • Proposed as answer by jattscorpion Tuesday, June 18, 2013 9:53 AM
    • Edited by jattscorpion Tuesday, June 18, 2013 9:54 AM
    Tuesday, June 18, 2013 9:46 AM
  • Hi,

    We can plz give us some  examples about this and how to pass the user credentials.


    Please remember to click 'Mark as Answer' on the post that helps you or "Vote As Helpful"


    Tuesday, June 18, 2013 10:15 AM
  • I don't have the code snippet, but I think the time you will Add Reference it will take the credentials required to access and update the congfig to add endpoints.

    Links posted in my answer above explains that how to call WCF from jQuery.

     
    Tuesday, June 18, 2013 10:56 AM
  • It is possible, no matter what we believe. Here is an extract from MSDN (apparently I can't add a link to my posts)

    Developers who create modern and mobile apps, including apps not built on the .NET Framework, can access Microsoft Dynamics CRM business data through the SOAP and OData endpoints of the organization web service. This web service supports certain authentication capabilities found in the OAuth 2.0 Protocol.

    The following list describes what is supported for modern and mobile app authentication:

    • Use of JSON web tokens in the HTTP authorization header
    • Authentication for the OData service by external apps (outside the browser)
    • Authentication for the Organization.svc/web (SOAP) service by external applications (outside the browser)
    • Proposed as answer by Miika Niemelä Wednesday, September 3, 2014 12:53 PM
    Wednesday, September 3, 2014 12:53 PM
  • This is sample code to connect from an external app to crm.

    ClientCredentials Credentials = new ClientCredentials();
            OrganizationServiceProxy serviceProxy=null;
            IOrganizationService service=null;
            public SampleConnect()
            {
                 // IOrganizationService service=null;
                Credentials.UserName.UserName = "serdcrmadmin";
                Credentials.UserName.Password = "S*rdadmin$";
                Uri OrganizationUri = new Uri("http://serdcrmsvr/SERDLKPRACTICE/XRMServices/2011/Organization.svc");

                using (serviceProxy = new OrganizationServiceProxy(OrganizationUri, null, Credentials, null))
                {
                     service = (IOrganizationService)serviceProxy;
                }
            }


    Wednesday, September 3, 2014 1:03 PM