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.

All other Modules /

Discuss all other Modules here.

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

Add custom method - silverstripe-restfulapi


Go to End


664 Views

Avatar
ChrisGr

Community Member, 1 Post

22 June 2015 at 2:45am

Hi, could anyone point me in the right direction with regards to creating a custom method using the silverstripe-restfulapi module. I have a Categories DataObject with many_many Venues DataObject relationship. I'd like to get all the related Venues.
I can get the related Venue IDs - {"ID":6,"CategoryName":"Spend the Night","Venues":[3,4]}] but I don't want to have to make too many requests in order to get all the Venues. It would be easier if I could just retrieve them by calling a custom method, something like api/Category/GetVenues(6).
Or maybe there is a much simpler way that I'm missing?
Thanks in advance.