Creating pages via the API
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;
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
Hi Boyan,
Nice post; looks like it addresses my issues. I'm off to import some pages now!
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
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