简体   繁体   English

如何通过Strongloop环回中的rest调用获取特定的属性名称

[英]how to get specific property name via rest call in strongloop loopback

I am having students model in loopback which is accessible via rest using this url. 我让学生在回送中建立模型,可以使用此URL通过休息进行访问。 /api/students rest call gives all the student data but I want to get only the registration numbers (regno) of students. /api/students rest call提供了所有学生数据,但我只想获取学生的注册号(regno)。 Like in sql (SELECT regno FROM students ). 就像在sql中一样(SELECT regno FROM students )。 how I should filter the above rest call to get only the registration numbers of students. 我应该如何过滤上述休息电话以仅获取学生的注册号。

Use the fields filter. 使用字段过滤器。

?filter[fields][regno]=true

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

?filter={"fields":"regno"}

如果要获得多列

?filter={"fields":["regno","column2","column3",....]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM