Curl command to delete an episode?

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
titantractor271
Posts: 83
Joined: Mon Jan 18, 2021 9:27 am

Curl command to delete an episode?

Post by titantractor271 »

I am trying to use CURL commands to delete an episode. I am getting a 400 error... What am I doing wrong? Or does someone have a working CURL command example?

rem curl -v -X POST http://192.168.254.84:80/recorded/cmd?i ... cmd=delete
curl --data-binary "" -X POST http://192.168.254.96:80/recorded/cmd?i ... cmd=delete

C:\test\>curl --data-binary "" -X POST http://192.168.254.96:80/recorded/cmd?id=f372d4eb & cmd=delete
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>400 Bad Request</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div class="B C BE">
<a href="/"><div class="T TE">HDHomeRun SCRIBE DUO</div></a>
400 Bad Request
</div>
</body>
</html>Microsoft Windows [Version 10.0.19041.1110]
(c) Microsoft Corporation. All rights reserved.

c:\test\>

nickk
Silicondust
Posts: 17172
Joined: Tue Jan 13, 2004 9:39 am
x 112

Re: Curl command to delete an episode?

Post by nickk »

Looks ok on first review.

Can you please turn on "send diagnostic information" from the device webpage system menu, try the delete cmd again, then post back with the device id.

Nick

Online
signcarver
Expert
Posts: 9858
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10A05954 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 22

Re: Curl command to delete an episode?

Post by signcarver »

did you add those spaces for posting or are they in your command?

I would also suggest putting the entire url in quotes (that was what was needed for me to get it to work using your example without spaces)

titantractor271
Posts: 83
Joined: Mon Jan 18, 2021 9:27 am

Re: Curl command to delete an episode?

Post by titantractor271 »

I just ran again with diagnostic information on. I tried with the quotes around the URL, but no difference. I think the spaces in the post above are just from posting.

Hardware Model HDVR-2US-1TB
Firmware Version 20210624
Device ID 151041BE
MAC Address 00:18:DD:51:04:1B
IP Address 192.168.254.96
Subnet Mask 255.255.255.0

nickk
Silicondust
Posts: 17172
Joined: Tue Jan 13, 2004 9:39 am
x 112

Re: Curl command to delete an episode?

Post by nickk »

The log shows a number of requests with no cmd - that will be due to using "&" without quotes around the URL.

Try:

Code: Select all

curl -X POST "http://151041BE.local/recorded/cmd?id=9ae4b7ae&cmd=delete"
Nick

Online
signcarver
Expert
Posts: 9858
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10A05954 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 22

Re: Curl command to delete an episode?

Post by signcarver »

Code: Select all

curl --data-binary "" -X POST "http://192.168.254.96:80/recorded/cmd?id=f372d4eb 
&cmd=delete"
I had no issues with that... nothing is returned but does delete... obviously i changed ip and id and did not attempt to delete it again since it was gone (which will also produce your "error")

Are you sure you put the entire url in quotes as the main issue is the & so you could try using a %26 or -d parameters but to me the quotes are easier (sometimes in scripts they may prefer single quotes)

titantractor271
Posts: 83
Joined: Mon Jan 18, 2021 9:27 am

Re: Curl command to delete an episode?

Post by titantractor271 »

Very strange, as I am using quotes. I'll need to do more testing. I tried in Win10 and on the Github Bash shell, both give the same error. I appreciate you confirming the format. If I continue to have problems or I can update, I will reach out and/or share respectively. Again, thx

Online
signcarver
Expert
Posts: 9858
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10A05954 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 22

Re: Curl command to delete an episode?

Post by signcarver »

Keep in mind that if you delete it, and use the same id again you will get the same error as the id is gone so the command is no longer valid.

nickk
Silicondust
Posts: 17172
Joined: Tue Jan 13, 2004 9:39 am
x 112

Re: Curl command to delete an episode?

Post by nickk »

2021-07-28 15:38:42 20210728-15:38:41 Playback: cmd delete: file not found
2021-07-28 15:38:59 20210728-15:38:59 Playback: cmd delete: file not found

titantractor271
Posts: 83
Joined: Mon Jan 18, 2021 9:27 am

Re: Curl command to delete an episode?

Post by titantractor271 »

Solved.... What I showed above was correct, when I tried some format changes I had "play" instead of "cmd".... Thx sorry for the confusion... Well at least we have some working samples for people:

curl --data-binary "" -X POST "http://192.168.254.96:80/recorded/cmd?i ... cmd=delete"


WORKED!!!

sdust
Posts: 154
Joined: Sat Jun 05, 2021 3:39 am
x 9

Re: Curl command to delete an episode?

Post by sdust »

titantractor271 wrote: Thu Jul 29, 2021 9:39 pm Solved.... What I showed above was correct, when I tried some format changes I had "play" instead of "cmd".... Thx sorry for the confusion... Well at least we have some working samples for people:

curl --data-binary "" -X POST "http://192.168.254.96:80/recorded/cmd?i ... cmd=delete"


WORKED!!!
-X POST is unnecessary ....

--data-binary is superfluous

it should be

Code: Select all

curl -d "" "http://192.168.254.96:80/recorded/cmd?id=09d7906d&cmd=delete"

nickk
Silicondust
Posts: 17172
Joined: Tue Jan 13, 2004 9:39 am
x 112

Re: Curl command to delete an episode?

Post by nickk »

sdust wrote: Fri Jul 30, 2021 9:23 am -X POST is unnecessary ....
POST is required as of release/firmware 20190621.

Nick

sdust
Posts: 154
Joined: Sat Jun 05, 2021 3:39 am
x 9

Re: Curl command to delete an episode?

Post by sdust »

nickk wrote: Fri Jul 30, 2021 9:39 am
sdust wrote: Fri Jul 30, 2021 9:23 am -X POST is unnecessary ....
POST is required as of release/firmware 20190621.
That's what -d already does. Using -X POST is unnecessary when using -d.

nickk
Silicondust
Posts: 17172
Joined: Tue Jan 13, 2004 9:39 am
x 112

Re: Curl command to delete an episode?

Post by nickk »

sdust wrote: Fri Jul 30, 2021 2:33 pm That's what -d already does. Using -X POST is unnecessary when using -d.
Oh that is neat. Will make a note of it.

Post Reply