silverstripe-restfulapi icon indicating copy to clipboard operation
silverstripe-restfulapi copied to clipboard

Specify fields to be returned

Open dylanitorium opened this issue 6 years ago • 2 comments

Hey colymba,

Love your work.

I was wondering if you'd accept a PR that extended the Basic Query Handler and Serialiser that would allow the user to specify which fields they would like to be returned, something like:

?__fields=ID,Title or ?__fields[]=ID&__fields[]=Title or both

Cheers! Dylan

dylanitorium avatar Nov 20 '17 03:11 dylanitorium

I +1 this, It would really help.

nimeso avatar Feb 20 '18 22:02 nimeso

Hey @dylanitorium, yes very much interested :) Since a lot of this sort fo task (filtering fields) have been done in the serialiser which semantically isn't that great. So... let's do it!

Do you know the impact/convention/constraint or using ?__fields=ID,Title or ?__fields[]=ID&__fields[]=Title? I think I had like to stick with just one, and I feel __fields[] is most natural one, but might make the URL length quite long?

colymba avatar Feb 21 '18 08:02 colymba