fix sample filtering in REST API