23007 Posts in 11866 Topics by 2828 members
|Go to End|
6 August 2010 at 8:44pm
I'm quite chuffed to have figured out how to use VB.Net to add a new page into the CMS, but so far have been unable to successfully publish that page via the RESTfulServer API. I'm planning to use this to pull knowledge base articles out of another product and create pages for them in the CMS.
After successfully creating the page, getting it's ID from the XML response - I create a POST web request to the URL "http://localhost/silverstripe/api/v1/Page/14/publish" (where 14 is the page ID) as per the wiki documentation, which then fails with a 401 unauthorised error. I have tried several options to pass credentials (for the admin user) but none seem to have worked.
I'm running SS version 2.4.1 on WAMPserver (Windows Apache MySQL PHP) and the basicauth module is enabled in Apache.
The current VB.net code I'm using for authentication (with the real user/password values of course) is:
webRequest.Credentials = New NetworkCredential("adminUserHere", "passwordHere")
webRequest.PreAuthenticate = True
I realise it's likely there are few, if any VB.Net devs here, but any thoughts are greatly appreciated!
7 August 2010 at 3:37pm Last edited: 7 August 2010 5:23pm
Edit: think I've got it figured out now, phew! Still, docs could do with a lot more information - looks like an issue with allowed actions on the class, not actually an authentication issue (I think).
|Go to Top|