Getting 400 error due to min character limit on show title

Hi,

I’m getting a 400 error with this query:

https://api.opensubtitles.com/api/v1/subtitles?imdb_id=26173858&query=Mo&languages=en&moviehash=aaa4d83b49ac65fa&season_number=2&episode_number=1

The returned error is:

{
  "errors": [
    "Query is too short"
  ],
  "status": 400
}

Couple of issues with this:

  1. “Mo” is the name of a show, and I’m able to search for it from the web front end, so this seems like a limitation of the API.
  2. The API documentation does not mention a 400 error code, so is this something that my code will have to deal with?

thanks for reporting, we’ll add the 400 in the docs, for missing or incomplete parameters.

when it comes to query lenght, minimum size is 3, under that there’s just too much noise on the results, normal process would be to obtain the imdb or tmdb it to query more accurately, from an external service or from the /features endpoint. in your example you already got the imdb id so the query doesn’t make sense.

actually, as you also have a season_number and episode number, in that case you should use the parent imdb id, or just the imdb id of the episode and skip the season and episode number.

Ok. Please also document the minimum length for the query parameter.

Tried to use the features endpoint, but keep getting a 406 error.

https://api.opensubtitles.com/api/v1/features?query=will+trent&type=tvshow&query_match=exact

Is it expecting the “feature_id” parameter? What is that supposed to be? I didn’t find any documentation for it.

Suggestion:
Have request examples that show the response, because right now, I have no idea what the request was to generate the example response.

may I ask how do you test the requests ? for your error I would need your exact request and headers, and the response from the server to tell you more, as it is not a problematic search.

here’s an example query as curl that you should be able to copy to successfully run your request

curl -L --request GET \
  --url 'https://api.opensubtitles.com/api/v1/features?type=tvshow&query=will%2Btrent&query_match=exact' \
  --header 'Api-Key: <YOUR_API_KEY>' \
  --header 'User-Agent: Mapp 22'

sure the documentation is frustrating by not showing a properly working example on the right side, we tried to work on that but could never make it work with spotlight, so when problem such as yours occur we just help out case by case users to setup insomnia or postman.

for the feature id, it can be used to query a feature from opensubtitle.com using its id to get the subtitles counts and the list of seasons and episodes for tv shows.