Creating pages via the API

Posted by Community Admin on 04-Aug-2018 00:13

Creating pages via the API

All Replies

Posted by Community Admin on 13-Nov-2011 00:00

I need to import a very large number of pages from our existing (non-Sitefinity) site.

I've built a WinForms app that retrieves and parses the existing pages to grab the content that I need. However, I'm at a loss as to how to get that content into Sitefinity.

I spent quite a bit of time today trying to use the ~/Sitefinity/Services/Pages/PagesService.svc, but I can't figure out how to give my WinForms app permission to call the service.

Finally, I decided to forego the web service API. Instead, I created a new web service that, in turn, uses some of the code from http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-pages-creating-pages.html to create a page. However, I'm again running into authorization issues.
I added this method to my web service:

[WebMethod]
public string WhoAmI()
    return "Running as User : " +
        Thread.CurrentPrincipal.Identity.Name;

which, when called from my WinForms app, returns "Anonymous."

Since this is a one-time import, I'm happy to give the Anonymous user rights to everything on the dev server. However, I'm not sure how to do that.

Help!

Better yet, are there any functioning examples available of using the Sitefinity services from a desktop application?


Posted by Community Admin on 16-Nov-2011 00:00

Hi David,

Can you please take a look at this blog post, where we've explained in details a simple scenario of using Sitefinity RESTful services, including authentication. We have provided a code sample of a working application as well, I believe you might find it useful. If there's anything else we can help you with, please let us know.

Kind regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 16-Nov-2011 00:00

Hi Boyan,

Nice post; looks like it addresses my issues. I'm off to import some pages now!

Posted by Community Admin on 23-Jan-2012 00:00

This is a great blog post; thanks for sharing it.

Can you please confirm whether you must log in before reading publicly-available data?  I ran the sample site from the blog post, and it is logging in just to get News items.  In my site, News items are publicly readable, yet I must still log in when reading them through the web service.

Thanks
Tim

Posted by Community Admin on 26-Jan-2012 00:00

Hi Tim,

Yes, indeed you must log in, even though the content is published, but this is not related to a security restriction imposed from Sitefinity, but rater a requirement for  WCF services communication to be established.

Regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed