Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Unable to publish using the RESTfulServer API and VB.Net


Go to End


2 Posts   1214 Views

Avatar
Andrew B

Community Member, 2 Posts

6 August 2010 at 8:44pm

Hi all,

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

Avatar
Andrew B

Community Member, 2 Posts

7 August 2010 at 3:37pm

Edited: 07/08/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).