0

I am having students model in loopback which is accessible via rest using this url. /api/students rest call gives all the student data but I want to get only the registration numbers (regno) of students. Like in sql (SELECT regno FROM students). how I should filter the above rest call to get only the registration numbers of students.

Farid Nouri Neshat
  • 29,438
  • 6
  • 74
  • 115
Rizwan Haider
  • 167
  • 2
  • 17

2 Answers2

1

Use the fields filter.

?filter[fields][regno]=true

https://docs.strongloop.com/display/public/LB/Fields+filter

duffn
  • 3,690
  • 8
  • 33
  • 68
1
?filter={"fields":"regno"}

If you want to get multiple columns

?filter={"fields":["regno","column2","column3",....]}
Rameez
  • 601
  • 1
  • 8
  • 22