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! :)