FIXED: Deleting Headends

Post Reply
cwchapma
Posts: 42
Joined: Fri Mar 29, 2013 8:32 am

FIXED: Deleting Headends

Post by cwchapma » Sat Apr 06, 2013 5:10 pm

It appears that deleting headends twice or delete headends that were never part of my list doesn't cause an error to be returned. Should it not be an error?

Thanks,
Clint
Last edited by cwchapma on Mon May 06, 2013 7:23 pm, edited 1 time in total.

rkulagow
SD Staff
Posts: 915
Joined: Tue Aug 14, 2007 3:15 pm

Re: Deleting Headends

Post by rkulagow » Thu Apr 11, 2013 11:30 am

It should. Are you testing against the production server or the beta server?

If it's the beta server, then things there are in flux. I had to rewrite a number of routines to convert the mish-mash of PHP / MySQL into a single standard, and I may have missed something.

I'd prefer tests against the beta server so that these sorts of bugs can be found. Please let me know the next time you attempt to do whatever that results in something you didn't expect so that I can check the logs.

cwchapma
Posts: 42
Joined: Fri Mar 29, 2013 8:32 am

Re: Deleting Headends

Post by cwchapma » Sun Apr 14, 2013 1:08 pm

Rob, I was testing on production and tried again but it appears to be offline for maintenance.

I tried the beta server and it appears to tack the default html on the end of the json response to delete headend request.

Code: Select all

{"response":"OK","code":200,"serverID":"AWS-micro.1","message":"Deleted headend.","changesRemaining":6,"datetime":"2013-04-14T19:48:49Z"}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>JSON API response</title>
</head>
<body>
<p>2.0: Use the API described in the <a href="https://github.com/rkulagowski/tv_grab_na_sd/wiki">Wiki</a></p>
</body>
</html>
Furthermore, it appears it allow me to delete a headend twice in a row:

Request:

Code: Select all

{"randhash":"----","request":"PC:K2J1T2","object":"headends","action":"delete","api":20130311}
Response:

Code: Select all

{"response":"OK","code":200,"serverID":"AWS-micro.1","message":"Deleted headend.","changesRemaining":6,"datetime":"2013-04-14T19:59:05Z"}
Request:

Code: Select all

{"randhash":"----","request":"PC:K2J1T2","object":"headends","action":"delete","api":20130311}
Response:

Code: Select all

{"response":"OK","code":200,"serverID":"AWS-micro.1","message":"Deleted headend.","changesRemaining":6,"datetime":"2013-04-14T20:01:54Z"}
Same thing happens with the another headend, "0005410", as well.

Hope that helps,
Clint

rkulagow
SD Staff
Posts: 915
Joined: Tue Aug 14, 2007 3:15 pm

Re: Deleting Headends

Post by rkulagow » Sun Apr 14, 2013 2:14 pm

>I tried the beta server and it appears to tack the default html on the end of the json response to delete headend request.

That should be fixed now.

I'm of two minds whether deleting the same headend is a bug. I'll think about it some more.

cwchapma
Posts: 42
Joined: Fri Mar 29, 2013 8:32 am

Re: Deleting Headends

Post by cwchapma » Sun Apr 14, 2013 4:10 pm

At least in .NET, anytime you try and remove and item that doesn't exist in a collection, it throws an exception. Not trying to be disagreeable, just trying to justify my opinion. :)

On the other hand I noticed when there are no headends specified in your list, and you try to get headends, it returns an error. I don't think that should be an error. I'm thinking it should just return an empty list.

Clint

rkulagow
SD Staff
Posts: 915
Joined: Tue Aug 14, 2007 3:15 pm

Re: Deleting Headends

Post by rkulagow » Mon Apr 15, 2013 9:24 am

Try running a delete and then a "double delete" on the beta server and let me know if it's better now.

cwchapma
Posts: 42
Joined: Fri Mar 29, 2013 8:32 am

Re: Deleting Headends

Post by cwchapma » Mon Apr 15, 2013 7:54 pm

Yes, I like that better. I hope everyone else does.

However, I really don't like that it returns an error when you have no headends added. I think it should just return an empty list. An error should mean you've done something wrong. Asking what headends are in the list when it's empty is perfectly valid/necessary thing to do.

Thanks for the updates.

Clint

Post Reply