On Wed, 17 Feb 2016 20:37:20 +0100, Jacob Carlborg wrote:
On 2016-02-17 16:54, John More wrote:
Jacob,
Thank you for your quick response.I was able to get it working correctly but discovered some anomalies along the way; that, I am sure if pursued would lead me into the depths of the framework where a mere mortal as I should fear to tread.
The addUserId(userData ud) would not work with any form of path "/userId, /userid, /user". What did work was addUserid(userData ud) with a path of "/userid".
After finding your documentation reference I looked at the
URLRouter registerRestInterface(TImpl)(
URLRouter router,
TImpl instance,
RestInterfaceSettings settings = null
);
and in particular the settings.methodStyle where I think the default is likely to be lowerCase.Seems I forgot to include the link for the documentation :)
I think the default method style is "lowerUnderscored" [1]. That would
mean "addUserId" would be mapped to "/user_id", unless it has some
special treatment of "id".Unfortunately figuring out how to set this on the call is beyond me at this point but I do have it working.
I think you set it something like this:
auto settings = new RestInterfaceSettings;
settings.methodStyle = MethodStyle.lowerUnderscored; // or whatever
style you prefer [2]auto router = new URLRouter;
router.registerRestInterface(new NoteStoreImplementation, settings);[1] http://vibed.org/api/vibe.web.common/MethodStyle.lowerUnderscored
[2] http://vibed.org/api/vibe.web.common/MethodStyle/Jacob Carlborg
Jacob,
I was able to play with the different method styles and get them working.
As I said I am really a neophyte when it comes to object oriented programming and so tracing this has been very helpful.
I am now working on adding basic authentication to a Rest service using the registerRestInterface and of course after a couple of days of experimentation I am hopelessly lost. If you could point me in a direction or if you know of a sample I would really appreciate the knowledge.
If you think I should start a new thread I would be happy to do so.
Thanks
John