ahm012
February 13, 2025, 5:14pm
1
Hi guys, just trying to learn about the use of curl and how to prepare de URL.
If I run this command:
curl -i ‘htt://localhost:7557/devices’ it works perfect and show the information of all devices.
going to query a specific device, I try e.g.:
curl -i ‘http://localhost:7557/devices/?query={“_id”%3A"DCBB96-FD-HG8421C-485754439613CA40"}&projection=_tags ’
I get and OK connection but empty response when I actually added a tag to the device.
HTTP/1.1 200 OK
GenieACS-Version: 1.2.13+240606fc80
Content-Type: application/json
total: 0
Date: Thu, 13 Feb 2025 17:11:10 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
[
]
Here is the output of the query for all devices (I have only one)
,“_tags”:[“acl”]},
Similar when trying other type of query…any idea?? Haven’t found much information about this…
Thanks in advance!!!
Regards,
Hernan.-
dustin
February 13, 2025, 5:30pm
2
Here is what works for me:
My device ID: CCBE59-ENT-CXNK0051A85D
curl -i "http://localhost:7557/devices/?query=%7B%22_id%22%3A%22CCBE59-ENT-CXNK0051A85D%22%7D&projection=_tags"
akcoder
February 13, 2025, 6:09pm
3
As @dustin eluded to, the query param needs to be URL encoded.
ahm012
February 14, 2025, 12:30pm
4
My Devce ID: DCBB96-FD%2DHG8421C-485754439613CA40
acsgenie@acsgenie2:~$ curl -i “http://localhost:7557/devices/?query={“_id”%3A"DCBB96-FD-HG8421C-485754439613CA40"}&projection=_tags ”
HTTP/1.1 200 OK
GenieACS-Version: 1.2.13+240606fc80
Content-Type: application/json
total: 0
Date: Fri, 14 Feb 2025 12:24:58 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
[
]
Strange isn’t it?
dustin
February 14, 2025, 12:55pm
5
I think it’s because of the %2D in your DeviceID
Try this url instead:
curl -i "http://localhost:7557/devices/?query=%7B%22_id%22%3A%22DCBB96-FD%252DHG8421C-485754439613CA40%22%7D&projection=_tags"
ahm012
February 14, 2025, 1:33pm
6
dustin:
%25
Got it working now!!!
Thanks a lot !!!