Page 1 of 1

Bug in API calls for history

Posted: September 3rd, 2020, 4:05 am
by kacaukacau

Code: Select all

http://sabnzbd:8080/api?mode=history&start=0&limit=30&category=movies&apikey=(removed)&output=json
will also return results with downloads not in the category movies, and also not all downloads that are in the category movies are returned.

Code: Select all

http://sabnzbd:8080/api?mode=history&start=0&limit=30&apikey=(removed)&output=json
shows some downloads in category movies that wasn't shown with the first request.

Re: Bug in API calls for history

Posted: September 3rd, 2020, 5:54 am
by safihre
Hmmm, I can't reproduce that.
The history calls haven't been changed in years so I am bit surprised they would have an error.
Could you show us some output examples?

Re: Bug in API calls for history

Posted: September 3rd, 2020, 8:10 am
by kacaukacau
Sure. Output of

Code: Select all

curl 'http://sabnzbd:8080/api?mode=history&category=movies&apikey=(removed)&output=json' | jq -r ".[].slots[] | {name: .name, category: .category}"

Code: Select all

{
  "name": "Blue.Bloods.S09E19.Common.Enemies.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTb-postbot",
  "category": "tv"
}
{
  "name": "Barnwood.Builders.S08E02.Hidden.History.720p.WEBRip.x264-CAFFEiNE",
  "category": "tv"
}
{
  "name": "Blue.Bloods.S09E22.iNTERNAL.720p.HEVC.x265-MeGusta",
  "category": "tv"
}
{
  "name": "Blue.Bloods.S09E20.1080p.WEB.H264-AMCON",
  "category": "tv"
}
{
  "name": "Blue.Bloods.S09E21.Identity.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb",
  "category": "tv"
}
{
  "name": "Better.Things.S03E08.1080p.WEB.H264.1-MEMENTO",
  "category": "tv"
}
{
  "name": "Central.Intelligence.2016.Unrated.UHD.BluRay.2160p.DTS-HD.MA.5.1.HEVC.REMUX-FraMEeSToR-AsRequested",
  "category": "movies"
}
{
  "name": "Dance.With.Wolves.Directors.Cut.1990.MULTi.1080p.BluRay.x264-FHD",
  "category": "movies"
}
{
  "name": "Harold.&.Kumar.Go.to.White.Castle.2004.Extreme.Unrated.1080p.BluRay.DTS.x264-CtrlHD",
  "category": "movies"
}
{
  "name": "Dance.With.Wolves.Directors.Cut.1990.MULTi.1080p.BluRay.x264-FHD",
  "category": "movies"
}
{
  "name": "Harold.&.Kumar.Go.to.White.Castle.2004.Extreme.Unrated.1080p.BluRay.DTS.x264-CtrlHD",
  "category": "movies"
}
And also I found out that history call only returns the result in the first page, which means it's dependent on the web-interface. If web-interface is set to 10/page then it'll return 10 results for a call, if web-interface is set to show 250/page, then it'll return 250 results. Not sure if this is by design, but imo API calls shouldn't be dependent on web-interface settings.

Re: Bug in API calls for history

Posted: September 3rd, 2020, 8:51 am
by safihre
I now saw your post on Reddit: https://www.reddit.com/r/SABnzbd/commen ... m_sabnzbd/
Now I understand.

The jobs you are seeing are not yet processed, so not in the database. This is probably an actual bug!

Re: Bug in API calls for history

Posted: September 3rd, 2020, 11:00 am
by safihre
Yeah, it's a bug.. Will fix in 3.1.0.