Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Unable to publish using the RESTfulServer API and VB.Net

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

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

Page: 1
Go to End
Author Topic: 740 Views
  • Andrew B
    Avatar
    Community Member
    2 Posts

    Unable to publish using the RESTfulServer API and VB.Net Link to this post

    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!

  • Andrew B
    Avatar
    Community Member
    2 Posts

    Re: Unable to publish using the RESTfulServer API and VB.Net Link to this post

    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).

    740 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.