API device query returns all devices

Dan Morphis dan at milkcarton.com
Mon Apr 15 13:13:42 EDT 2019


You are encoding the = part of the query string. Try this:
curl 'http://localhost:7557/devices/?query
<http://localhost:7557/devices/?query%3D%7B%22_id%22%3A%22>*=*
%7B%22_id%22%3A%22FFFFFF-uc100-DD38%252D1227%252DC138%252D0021%22%7D&projection=_id'

-dan

On Fri, Apr 12, 2019 at 6:29 PM Rickard Johansson <
rickard.johansson at equiinet.com> wrote:

> Hi,
>
> Trying to query a specific device for some parameters with curl, but the
> API always returns all the devices. I might search for the id's
> incorrectly, but whichever way I try to url encode the device ID I can't
> get it to work. Any suggestions?
>
> Device: FFFFFF-uc100-DD38-1227-C138-0021
> http://localhost:3000/devices/FFFFFF-uc100-DD38%252D1227%252DC138%252D0021
>
> # curl 'http://localhost:7557/devices/?query%3D%7B%22_id%22%3A%22
> *FFFFFF-uc100-DD38-1227-C138-0021*%22%7D&projection=_id'
> [
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0021"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0013"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0010"}
> ]
>
> # curl 'http://localhost:7557/devices/?query%3D%7B%22_id%22%3A%22
> *FFFFFF-uc100-DD38%252D1227%252DC138%252D0021*%22%7D&projection=_id'
> [
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0021"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0013"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0010"}
> ]
>
> # curl  'http://localhost:7557/devices/?query%3D%7B%22_id%22%3A%22
> *FFFFFF-uc100-DD38%2D1227%2DC138%2D0021*%22%7D&projection=_id'
> [
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0021"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0013"},
> {"_id":"FFFFFF-uc100-DD38%2D1227%2DC138%2D0010"}
> ]
>
> Regards,
> Rick
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20190415/0c88ddd2/attachment.html>


More information about the Users mailing list