API V2.x Discussion

A place for developers to advertise their TheTVDB.com enabled app and get help from other developers with the API.
random_dev
Posts: 4
Joined: Tue Sep 06, 2016 3:27 pm

Thu Sep 08, 2016 9:50 am

@imniklas thanks for confirming that. A frustrating limitation. So to get an update on say The Daily Show, I will need to make 33 api calls (that's how many pages are in that show's episode query) to look for any new episodes. Seems inefficient. But I guess maybe Thetvdb doesn't see that as a major use case?
MattS
Posts: 217
Joined: Fri Mar 26, 2010 10:17 pm
Contact:

Thu Sep 08, 2016 10:01 am

If there's specific needs/bugs/requests, please use Trello so we can track or I can almost guarantee they'll get missed. Features like sorting and such could potentially be added in the near term but tracking such requests on the forums is painful at best.
random_dev
Posts: 4
Joined: Tue Sep 06, 2016 3:27 pm

Thu Sep 08, 2016 12:39 pm

@MattS thanks for giving the right way to make a feature request. The Trello board linked here:
viewtopic.php?f=17&t=29984
says I should be adding a request to this board:
https://trello.com/b/ZeC1OCZ4
but looks like I need additional permissions? Could you help with this? (me Trello username is the same as here - random_dev)

Thanks
MattS
Posts: 217
Joined: Fri Mar 26, 2010 10:17 pm
Contact:

Thu Sep 08, 2016 12:58 pm

random_dev wrote:@MattS thanks for giving the right way to make a feature request. The Trello board linked here:
viewtopic.php?f=17&t=29984
says I should be adding a request to this board:
https://trello.com/b/ZeC1OCZ4
but looks like I need additional permissions? Could you help with this? (me Trello username is the same as here - random_dev)

Thanks


All set, thanks!
random_dev
Posts: 4
Joined: Tue Sep 06, 2016 3:27 pm

Thu Sep 08, 2016 1:13 pm

Wow - that was fast - thanks :)
j3d247
Posts: 1
Joined: Sun Sep 25, 2016 7:42 pm

Sun Sep 25, 2016 7:46 pm

devildant wrote:I have a small question too :)
would it be possible to have a partial search ?
for example :
https://api.thetvdb.com/search/series?name=smallville return one result
https://api.thetvdb.com/search/series?name=smallvi return zero result


Is there any plans to implement something like this?
I checked to see if it was on the trello, but I couldn't see it - this would be a huge UX benefit if possible :)

A little more interestingly, I tried searching "Teen Wolf" partially, and while, "Teen" gives a list of, seemingly partial search results (Teen wolf included), "Teen W" doesn't.

Thanks for the hard work so far!
Jeffmong
Posts: 17
Joined: Thu Nov 06, 2014 8:31 pm

Tue Oct 04, 2016 7:25 am

I have tried searching and read through the pages and have seen similar questions but unsure.

If I am going about this the wrong way then please advise, as this process seems to take so much longer on the new API

Currently It appears I need to:
1 . Check for updated series since last update via the "/updated/query" and grabbing the series id's that I am interested in.
2 . The update data does not distinguish between series or episodes so for each id grabbed above, calling "/series/{id}" and comparing the last updated and updating if necessary
3. Calling "/series/{id}/episodes" for the updated id's and checking against my data for any new episodes and adding if needed (no "lastUpdated" field here so unable to check which have changed)
4. For each episode linked to the "seriesId" from the updates query, calling "/episodes/{id}". Finally being able to check "lastUpdated" against my data and updating if needed.

So for example: Simpsons
1 = 1 call for updates
2 = 7 calls to get the full paginated list of episodes
3 = 663 calls to find which have been updated

Total 771 calls to the new API, old API 2 calls as I used to grab the zip if updated.

Is there a way to get all the episode information for a series in one go, or at the least is there a way to get the lastUpdated field for each episode on the "/series/{id}" call, then a separate call for can be made to the "/episodes/{id}" only for those records that have been updated.

or will the "thetvdb.com/api/Updates.php?type=episode&time=xxxxxxxxxx" still be active when APIv1 goes offline?
grebulator
Posts: 2
Joined: Sun Oct 30, 2016 3:52 am

Sun Oct 30, 2016 4:09 am

I am able to authenticate via the web page https://api-beta.thetvdb.com/swagger but get a 401 response when trying via python script:

url = "https://api-beta.thetvdb.com/login"

user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"

payload = { "apikey": "XXXXXXXXX" }

headers = { "Content-Type": "application/json", "Accept": "application/json", "User-Agent": user_agent }

the_response = requests.post(url=url, data=payload, headers=headers)

I've tried including username and userkey but get the same response. Any ideas why this isn't working?
Jeffmong
Posts: 17
Joined: Thu Nov 06, 2014 8:31 pm

Mon Oct 31, 2016 4:55 am

grebulator wrote:I am able to authenticate via the web page https://api-beta.thetvdb.com/swagger but get a 401 response when trying via python script:

url = "https://api-beta.thetvdb.com/login"

user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"

payload = { "apikey": "XXXXXXXXX" }

headers = { "Content-Type": "application/json", "Accept": "application/json", "User-Agent": user_agent }

the_response = requests.post(url=url, data=payload, headers=headers)

I've tried including username and userkey but get the same response. Any ideas why this isn't working?


Hi grebulator,

Your payload nees to be JSON encoded

Include:

import json

and change "requests.post(url=url, data=payload, headers=headers)" to

requests.post(url=url, data=json.dumps(payload), headers=headers)
grebulator
Posts: 2
Joined: Sun Oct 30, 2016 3:52 am

Mon Oct 31, 2016 10:46 am

Hi Jeffmong,

Perfect! That sorted it.

Thanks for your help, much appreciated :)
Post Reply