
The api current allows looking up an external ID using the `/lookup/shows` endpoint. I would like to be able to use the `lookup/shows/` route for tvmaze shows as well as it makes lookups simpler (e.g. `/lookup/shows?tvmaze=82`).
The api current allows looking up an external ID using the `/lookup/shows` endpoint. I would like to be able to use the `lookup/shows/` route for tvmaze shows as well as it makes lookups simpler (e.g. `/lookup/shows?tvmaze=82`).
If you know the TVmaze id already, you can just fetch "/shows/82" ;-)
Obviously :)
The main reason I would be interested in this is given a source (e.g. tvmaze, imdb, etc) and it's related ID, I could hit the same endpoint.
e.g. in python (using _ for indentation):
import requests
shows = [{'tvamze': 1}, {'imdb': 'tt0944947'}]
for show in shows:
__requests.get('https://api.tvmaze.com/lookup', params=show)
instead I have to do something like the following:
import requests
shows = [{'tvamze': 1}, {'imdb': 'tt0944947'}]
for show in shows:
__try:
____requests.get('https://api.tvmaze.com/shows/{0}'.format(show['tvmaze']))
__except KeyErorr:
____requests.get('https://api.tvmaze.com/lookup', params=show)
No need to try it if it's not present;
if show['tvmaze'] is not None:
____requests.get('https://api.tvmaze.com/shows/{0}'.format(show['tvmaze']))
else:
____requests.get('https://api.tvmaze.com/lookup',params=show)
There's not really anything detrimental to calling a URL dependent on the parameters.
@gazza911 that's just two different ways of doing the same thing. Also in python exception handling is faster than if statements which is why I used try/except. The idea is calling a single endpoint is simpler than calling two separate endpoints.
Ideally I would prefer restful endpoints for external lookup. For example my app exposes endpoints such as `/{source}/{id}` so a single url can be used for any source e.g. `/tvmaze/82` or `/imdb/tt0944947`. I figured adding the local IDs to the lookup would be easier to implement than adding restful endpoints though.
I don't think this is going to happen, sorry. I'm not a fan of providing more than one way to reach exactly the same result in the API.
But that's exactly my point david, right now you do have two different methods to get to exactly the same result. A restful endpoint and a lookup. I'm proposing condensing that to a single method.
No, that is not true. Right now they don't use two different methods. One is a direct link/pointer to the content, while the others is a lookup method.