As we discussed offline, best option for this is to have a API that user
could define fields that he needed (eg: described in [1]). That need some
effort we cannot afford with the time fact right now and we know that, most
of the use cases can be addressed having two filters like Lahiru suggested.
How about following.

*?field_filter=basicFields*
*?field_filter=allFields*

[1]
http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#limiting-fields

Regards,
Dinusha.

On Thu, Apr 28, 2016 at 3:22 PM, Dilshan Edirisuriya <[email protected]>
wrote:

> Sorry I didnt get the context initially.
>
> On 28 April 2016 at 11:06, Lahiru Cooray <[email protected]> wrote:
>
>> Hi Dilshan,
>> Yes we have followed the offset/limit approach to limit the response
>> length (eg: no of apps returned)
>> But here our requirement is to limit the data/field in response (eg:
>> attributes of an app)
>>
>>
>> On Thu, Apr 28, 2016 at 11:03 AM, Dilshan Edirisuriya <
>> [email protected]> wrote:
>>
>>> As in other products[1] why don't you follow the limit offset approach?
>>> It has to be consistent among the platform?
>>>
>>> [1] -
>>> https://github.com/wso2/product-emm/blob/master/modules/apps/jax-rs/mdm-admin/src/main/java/org/wso2/carbon/mdm/api/Operation.java
>>>
>>> Regards,
>>>
>>> Dilshan
>>>
>>> On 28 April 2016 at 10:53, Lahiru Cooray <[email protected]> wrote:
>>>
>>>> Hi,
>>>> We are currently implementing REST API for AppM and we need to
>>>> introduce a response field filter to limit the response(fields).
>>>> So I propose to use the a query param, *?field_filter=TOUCH* (returns
>>>> basic data which is default) and *?field_filter=ALL* (returns complete
>>>> dataset).
>>>> Please share your thoughts.
>>>>
>>>> *eg:*
>>>> /apps?field_filter=TOUCH (which is default)
>>>> {
>>>>   "previous": "",
>>>>   "next": "",
>>>>   "list": [
>>>>     {
>>>>       "name": "app1",
>>>>       "context": "/app1",
>>>>       "id": "65c8485d-11d9-4f05-a418-17dfb737e165"
>>>>     },
>>>>     {
>>>>       "name": "app2",
>>>>       "context": "/app2",
>>>>       "id": "c9ddf00d-c42f-4299-931c-bcda69c68050"
>>>>     }
>>>>   ],
>>>>   "count": 2
>>>> }
>>>>
>>>> /apps?field_filter=All
>>>> {
>>>>   "previous": "",
>>>>   "next": "",
>>>>   "list": [
>>>>     {
>>>>       "name": "app1",
>>>>       "context": "/app1",
>>>>       "id": "65c8485d-11d9-4f05-a418-17dfb737e165",
>>>>       "provider": "admin",
>>>>       "description": " ",
>>>>       "version": "1.0",
>>>>       "lifecycleState": "CREATED"
>>>>     },
>>>>     {
>>>>       "name": "app2",
>>>>       "context": "/app2",
>>>>       "id": "c9ddf00d-c42f-4299-931c-bcda69c68050",
>>>>       "provider": "admin",
>>>>       "description": " ",
>>>>       "version": "1.0",
>>>>       "lifecycleState": "CREATED"
>>>>     }
>>>>   ],
>>>>   "count": 2
>>>> }
>>>>
>>>> --
>>>> *Lahiru Cooray*
>>>> Software Engineer
>>>> WSO2, Inc.;http://wso2.com/
>>>> lean.enterprise.middleware
>>>>
>>>> Mobile: +94 715 654154
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>
>>
>> --
>> *Lahiru Cooray*
>> Software Engineer
>> WSO2, Inc.;http://wso2.com/
>> lean.enterprise.middleware
>>
>> Mobile: +94 715 654154
>>
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Dinusha Dilrukshi
Associate Technical Lead
WSO2 Inc.: http://wso2.com/
Mobile: +94725255071
Blog: http://dinushasblog.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to