Use API to retrieve members

Not sure of the SS version yet. Assume the latest.

Is it possible to retrieve all members names and emails using an API?
I need to retrieve these from an external platform so was hoping to be able to call a Silver Stripe API to get the member emails.
I would need to do this daily so the external platform remains synchronized with the SS data.

I had a look for documentation on Silverstripe APIs but couldn’t find anything that helpful or any examples.

Any help appreciated!

I guess the number of Members is going to be a consideration but as a starting point I would probably just create a custom controller end point, loop over Member::get() to create an array in the format you need, then send it with jsonencode(). There might be a more efficient way but that should work okay if you don’t have tens or hundreds of thousands of members. You would presumably want to require some kind of authorisation for that like an API key too, which you could check for in the request.

For something more formal you could look at https://addons.silverstripe.org/add-ons/silverstripe/restfulserver

1 Like

So there is nothing built in that could deliver this out of the box, it would need some development on the Silverstripe side?

I think so. Most things like this need at least a little bit of custom code because Silverstripe is designed to give you building blocks to make what you want with minimal effort, rather than try to do everything for you. Plus, normally you wouldn’t want to expose your member list on a public endpoint as it could be considered sensitive information.

1 Like