"Search" API Help

This works for me:
curl -XGET "http:/192.168.0.232:8089/dvr/guide/search/groups?q=Family"

But I can't get a space to work. This fails:

curl -XGET "http:/192.168.0.232:8089/dvr/guide/search/groups?q=Family%20Feud"

Also fails with a real space.

What am I doing wrong?

Works for me..

I'm really stumped.
curl -XGET "http:/192.168.0.232:8089/dvr/guide/search/groups?q=Family%20Feud"
Returns just empty brackets. As in []

curl -XGET "http:/192.168.0.232:8089/dvr/guide/search/groups?q=Feud"
Returns:
[{"ID":"8314079","Image":"https://tmsimg.fancybits.co/assets/p8314079_b_h6_ab.jpg","Name":"Family Feud","SeriesID":"8314079"},{"ID":"12405544","Image":"https://tmsimg.fancybits.co/assets/p12405546_b_h6_aa.jpg","Name":"Blood Feuds","SeriesID":"12405544"}]

and "Family" returns even more stuff because of multiple matches.

Anything I try with a "%20" in it fails. Any single word works as expected.

Windows 10 client, 2nd Windows 10 server. Curl 7.75.0

Results remained unchanged when run from localhost.

Anything else I can try?

Try curl.exe instead of curl

I tried Curl.exe and an old version of Curl (7.55.1). Then I looked at the Channels Log File.

I sent:
"/dvr/guide/search/groups?q=Bret%20Baier

But the log file shows that the "%20" was sent as "0" (zero).

"/dvr/guide/search/groups?q=Bret0Baier"

This explains why I always get an empty match with a %20 in the search, but I have no clue as to why the %20 doesn't get sent to the server.

Any more ideas?

Ken

Maybe works better in Powershell vs cmd.exe. I guess "%2" has some special meaning in Windows and you need to escape it accordingly.

Thanks for the Powershell guess, but that was not it.

*** PROBLEM SOLVED ***
I poked around the Internet and found this. It works.

curl -G "http:/192.168.0.232:8089/dvr/guide/search/groups" --data-urlencode "q=Bret Baier"

I don't fully understand why this works when the other command did not, but I'm a happy camper. I think this is the final link in my current project.

Thanks all who took the time to contribute.

I talked to a friend of mine who gave me this command which also works.

curl -XGET "http:/192.168.0.232:8089/dvr/guide/search/groups?q=Bret%%20Baier"

Ken

Just in cast someone in the future is reading this, I want to fully explain what happened.

I was running this command from a Windows Command Batch file (.bat). In a batch file, %2 has a special meaning. It indicates that before the line is executed, the %2 should be replaced with the second parameter that was passed to the batch file at the start. In this case there was no parameter passed to the batch file, so %2 was replaced with an empty string causing "%20" to become just "0".

%%20 worked because %% tells the batch file processor to not do the substitution, which made it work as needed.

If this same command line is typed directly to the command prompt, the double %% is not needed and will not work.

If you pass the command to Curl from within a running program that does not use the Batch File Processor, do not use the double %%.

1 Like

I'm not a Windows user, so I'm curious if it follows the same rules as *nix shells: if the variable (%2 in this case) is used within double-quotes ("), it will be expanded/substituted, but if it is used within single-quotes ('), then it is passed as typed, without the substitution.

Quotes don't matter in a batch file. %2 will always be the value of the second passed parameter. %%2 will always be %2.

Ken