+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Use API from other (non web) app?

Use API from other (non web) app?

8 posts, 0 answered
  1. Eric
    Eric avatar
    4 posts
    Registered:
    01 Feb 2011
    02 Feb 2011
    Link to this post
    I am trying to use the Sitefinity API from within a Non Sitefinity application, to get at the data.  However, I can't figure out configuration necessary to do this?  I have tried including the config files from app_data/Sitefinity but get errors.   
    Is this possible?  

    Thank You
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Feb 2011
    Link to this post
    Hello Eric,

    You have to use web services calls to access the content data. There are built-in services that you can use.
    Note that you should be authenticated when you want to work with the API, so I suggest that you should check this post.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Eric
    Eric avatar
    4 posts
    Registered:
    01 Feb 2011
    03 Feb 2011
    Link to this post
    Thank You for the response, however I am also having problems authenticating the Web Services?  

    The code examples I have seen seem to be calling from client, but I am trying to call from another Application:
    http://www.sitefinity.com/40/help/developer-manual/client-side-programming-working-with-web-services.html

    I call the web services and get a http 412 error:  Pre-condition not met 

    I have tried http://localhost/Sitefinity/Services/Content/BlogService.svc/?username=admin&password=admin and a variety of other things.  

    Thank You




  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Feb 2011
    Link to this post
    Hi Eric,

    Using the code from one of the posts I sent you, you should be able to authenticate yourself. If you type help  after the service you will  be able to see the parameters that you have to pass.

    1. You can access the service with javascript by using Sys.Net.WebRequest() or/and
    2. Using server side code  and making HttpWebRequest



    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Eric
    Eric avatar
    4 posts
    Registered:
    01 Feb 2011
    03 Feb 2011
    Link to this post
    I have tried that code (the 2nd http web request block) exactly, and with modifcations for just http GET:

    If I make the request with http get I get http 412 error:   Status Code:412 ..::login|session|expired::../Sitefinity/Login/Ajax

    If I make the request with http POST i get http 405 method not allowed error

    I checked the web.config which has the webDav module removed.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Feb 2011
    Link to this post
    Hi Eric,

    The error you see is thrown by RequestAuthentication() static method of ServiceUtility class. You get a WebProtocolException when SystemManager.CurrentHttpContext.User.Identity.IsAuthenticated. The user you use is not authenticated.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Eric
    Eric avatar
    4 posts
    Registered:
    01 Feb 2011
    04 Feb 2011
    Link to this post
    Thank you for the response.

    How do I authenticate the service call, it is coming from a different application.   So, i need to be able to authenticate the service calls programatically using an admin or service account.  Is there a way to "logon" programitcally to create a cookie which I can add to the service calls?   

    Thank You
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Feb 2011
    Link to this post
    Hello Eric,

    I do not see what would be the problem if you use the code attached in one of the posts I sent you. Can you tell me what would stop you from using such a model to authenticate a user?
    Getting the cookie will not do the trick, because you need to supply username and password to AuthenticateUser method.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
8 posts, 0 answered