简体   繁体   English

获取响应正文对象中的自定义字段

[英]Custom Fields in get response body object

How to make custom fields that displays in get response body by sending fields in request header like this GET: api/v1/custom-fields?fields=name,city,state如何通过在请求标头中发送字段来制作显示在获取响应正文中的自定义字段,例如 GET:api/v1/custom-fields?fields=name,city,state

That means I should display name, city, state values only in get response not all fields from response object.这意味着我应该只在获取响应时显示名称、城市、州值,而不是响应对象的所有字段。

What you're looking for is SelectableEntityFilteringFeature .您正在寻找的是SelectableEntityFilteringFeature After registering this feature, In the request object you can select the fields that you want to display.注册此功能后,您可以在请求对象中选择要显示的字段。

So in you're case the request URL would say select certain fields.所以在你的情况下,请求 URL 会说select某些字段。

api/v1/custom-fields?select=name,city,state

And in the return object, only values of "name,city,state" will be returned and not the whole object.在返回对象中,只会返回“name,city,state”的值,而不是整个对象。

Refer to the example provided here .请参阅此处提供的示例。

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

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