Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
brunovg
Posts: 3
Joined: Mon Apr 22, 2024 6:29 pm

403 error

Mon Apr 22, 2024 6:42 pm

Hello everyone..
I'm trying to use opensubtitles API on my newly Flutter project, but I constantly get a 403 as a response.
Sometimes it works, but rarely.

Request call
GET /api/v1/features?query=Jurassic HTTP/1.1
user-agent: MyAppName v1
accept: application/json
accept-encoding: gzip
host: api.opensubtitles.com:443
content-type: application/json
api-key: S**************4

Response body
<!DOCTYPE html>
<html>
<head>
<title>403 User-Agent header is wrong; set it to YOUR App name with version eg: MyApp v1.2.3</title>
</head>
<body>
<h1>Error 403 User-Agent header is wrong; set it to YOUR App name with version eg: MyApp v1.2.3</h1>
<p>User-Agent header is wrong; set it to YOUR App name with version eg: MyApp v1.2.3</p>
<h3>Guru Meditation:</h3>
<p>XID: 60952364</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>


I don't have any problems from Postman or CURL, on the same machine.

Any guess? :roll:

brunovg
Posts: 3
Joined: Mon Apr 22, 2024 6:29 pm

Re: 403 error

Mon Apr 22, 2024 9:29 pm

And yes, I used my app name on the User-Agent header, the same way I'm sending on Postman and Curl.

brunovg
Posts: 3
Joined: Mon Apr 22, 2024 6:29 pm

Re: 403 error

Mon Apr 22, 2024 9:37 pm

Ok... after reading some other posts, someone mentioned the X-User-Agent header.
And works perfectly now with that additional header.
Maybe it's a good idea to refer this on the main API documentation page.

User avatar
oss
Site Admin
Posts: 5893
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: 403 error

Tue Apr 23, 2024 9:09 am

you are right, we should add it there.

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 3 guests