Page 1 of 9

[OS] Brand new REST API for testing

Posted: Fri Apr 24, 2020 7:09 am
by oss
TEST AWESOME NEW REST API - this will be our future API.

We are full time developing new site and of course we are aware of need new modern REST API. You are invited to test it.

- don't use it in production, this is just for testing
- REST API URL will be changed in future
- it comes without any warranty

Read documentation REST API DOCUMENTATION HERE:

https://www.opensubtitles.com/docs/api/html/index.htm

Let us know what you think.

Re: [OS] Brand new REST API for testing

Posted: Sun May 10, 2020 1:31 am
by nafr1
Not working... it just gives response 503 for all requests

Re: [OS] Brand new REST API for testing

Posted: Thu Jun 04, 2020 2:38 am
by achva
Hi,

This is still not working.

I'm trying to login and I'm receiving this error for all requests.
I have the same user and password to both sites (opensubtitles.org and opensubtitles.com beta), and I'm not sending the wrong user/password.

{"errors":["Invalid domain"],"status":401}

Re: [OS] Brand new REST API for testing

Posted: Thu Jun 04, 2020 6:05 am
by oss
will be fixed soon, we are in process of changing endpoint and it is not finished yet

Re: [OS] Brand new REST API for testing

Posted: Thu Jun 04, 2020 1:14 pm
by os_dev
it's working now. I also published my work in progress for the documentation that looks a bit better now

Re: [OS] Brand new REST API for testing

Posted: Thu Jun 04, 2020 2:43 pm
by achva
It's working now. Thanks.

Re: [OS] Brand new REST API for testing

Posted: Wed Jul 15, 2020 10:05 am
by Falsyana
So I am trying to migrate my app to the new API but I seem to fail at the first step: login.

According to the documentation login should be as easy as:
curl "https://www.opensubtitles.com/api/v1/login" -d '{
"username": "testuser",
"password": "password"
}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json"

But whenever I do this with my username/password i get the 401 unauthorized result.

It is the same username & password combination I use to login on the website (https://www.opensubtitles.com/en#modal-login).
Should I be using a different account? Or did I miss a step?

Thanks!

Re: [OS] Brand new REST API for testing

Posted: Wed Jul 15, 2020 4:06 pm
by os_dev
So I am trying to migrate my app to the new API but I seem to fail at the first step: login.

According to the documentation login should be as easy as:
curl "https://www.opensubtitles.com/api/v1/login" -d '{
"username": "testuser",
"password": "password"
}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json"

But whenever I do this with my username/password i get the 401 unauthorized result.

It is the same username & password combination I use to login on the website (https://www.opensubtitles.com/en#modal-login).
Should I be using a different account? Or did I miss a step?

Thanks!
Hi,

Oh that's strange, this should be working as described, using your regular login/password from opensubtitles.com
it's really important that the X POST is specified, as well as the 2 headers

But... are you using shell actually ? if you don't know it yet, try postman https://www.postman.com/downloads/

note about the migration.... we are clear that for now it's for development only right ? (still updates and optimization necessary before production use)

let me know if it works

cheers

Re: [OS] Brand new REST API for testing

Posted: Wed Jul 15, 2020 4:49 pm
by Falsyana
Heya,

Yes I am using shell (bash) and kinda copy pasted it:

Code: Select all

# curl "https://www.opensubtitles.com/api/v1/login" -d '{"username": "falsyana", "password": "xxxxxxxxxxxxx"}' -X POST -H "Accept: application/json" -H "Content-Type: application/json" {"message":"Error, Unauthorized","status":401}
(of course my username and password are replaced)

Also my application (written in PHP) gives the same error.

And yes it is clear that is for development only :D

Re: [OS] Brand new REST API for testing

Posted: Thu Jul 16, 2020 9:05 am
by os_dev
Heya,

Yes I am using shell (bash) and kinda copy pasted it:

Code: Select all

# curl "https://www.opensubtitles.com/api/v1/login" -d '{"username": "falsyana", "password": "xxxxxxxxxxxxx"}' -X POST -H "Accept: application/json" -H "Content-Type: application/json" {"message":"Error, Unauthorized","status":401}
(of course my username and password are replaced)

Also my application (written in PHP) gives the same error.

And yes it is clear that is for development only :D
hmm, that's really strange, I'm on the API all day long, it's working fine in my postman, and ruby apps.

But I got the same error with the shell now, copying exactly your command, but if I put the X POST as first argument it works

curl -X POST "https://www.opensubtitles.com/api/v1/login" -d '{"username": "falsyana", "password": "xxxxxxxxxxxxx"}' -H "Content-Type: application/json" -H "Accept: application/json"

honeslty, I never use those, they are generated by the documentation tool, so thanks for pointing out these errors

For the PHP script, if you got a small script I can see, I'd be happy to check it out.

cheers

Re: [OS] Brand new REST API for testing

Posted: Thu Jul 16, 2020 3:43 pm
by Falsyana
But I got the same error with the shell now, copying exactly your command, but if I put the X POST as first argument it works

curl -X POST "https://www.opensubtitles.com/api/v1/login" -d '{"username": "falsyana", "password": "xxxxxxxxxxxxx"}' -H "Content-Type: application/json" -H "Accept: application/json"
It didn't matter for me if I placed the -X argument first or last.
But I found the issue: the problem was in the username, I used a capital in there. On the website it works but I assume, before it gets validated, it's converted to lowercase. That step is probably not done through the API.

So after I changed it to all lowercase the curl and my app are working fine :D

Re: [OS] Brand new REST API for testing

Posted: Fri Jul 17, 2020 10:57 am
by os_dev
But I found the issue: the problem was in the username, I used a capital in there. On the website it works but I assume, before it gets validated, it's converted to lowercase. That step is probably not done through the API.

So after I changed it to all lowercase the curl and my app are working fine :D
Wow yes you are right !! thanks a lot for pointing it out, I will fix that !!

Re: [OS] Brand new REST API for testing

Posted: Fri Aug 21, 2020 5:56 pm
by itstaha
So I am trying to migrate my app to the new API but I seem to fail at the first step: login.

According to the documentation login should be as easy as:
curl "https://www.opensubtitles.com/api/v1/login" -d '{
"username": "testuser",
"password": "password"
}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json"

But whenever I do this with my username/password i get the 401 unauthorized result.

It is the same username & password combination I use to login on the website (https://www.opensubtitles.com/en#modal-login).
Should I be using a different account? Or did I miss a step?

Thanks!
I have the same problem but my username and password are correct!
do I need something like a level or ..?

curl --location --request POST 'https://www.opensubtitles.com/api/v1/login' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{"username": "itstaha", "password": "********"}'

Re: [OS] Brand new REST API for testing

Posted: Sat Aug 22, 2020 3:00 am
by oss
this is working. You probably guys doesnt have account on www.opensubtitles.com

make sure you can login on www.opensubtitles.com and use same credentials into this API

Re: [OS] Brand new REST API for testing

Posted: Sat Aug 22, 2020 8:21 am
by os_dev
The shell commands are super basic examples, they do fail once in a while for me too, then I just replace the order of parameters, add or remove a space then it works.

This is a living hell, don't code like this, instead use something like postman https://www.postman.com/downloads/