I am describing a simple method which worked very smoothly in Python (Django Framework).
1. While sending the request, send the request like this
http://server/action?id=a,b
2. Now in my backend, I split the value received with a split function which always creates a list.
id_filter = id.split(',')
Example: So if I send two values in the request,
http://server/action?id=a,b
then the filter on the data is
id_filter = ['a', 'b']
If I send only one value in the request,
http://server/action?id=a
then the filter outcome is
id_filter = ['a']
3. To actually filter the data, I simply use the 'in' function
queryset = queryset.filter(model_id__in=id_filter)
which roughly speaking performs the SQL equivalent of
WHERE model_id IN ('a', 'b')
with the first request and,
WHERE model_id IN ('a')
with the second request.
This would work with more than 2 parameter values in the request as well !