It looks like you are using an old version of Internet Explorer. Sorry, we only support IE 10 and above. To use the site you will need to use a more up to date browser. We strongly recommend you upgrade to:

Hi LingQ administrators,

I am trying some of the LingQ APIs. And I found some of them don't work as expected:
GET https://www.lingq.com/api/languages/language/co...
Returns lesson text.
GET https://www.lingq.com/api/languages/language/co...
Returns lesson lingqs.
GET https://www.lingq.com/api/languages/language/co...
Returns lesson stats.
GET https://www.lingq.com/api/languages/language/le...
GET https://www.lingq.com/api/languages/language/co...

After a get request is sent, content is returned. The returned content is html source code but not jason structure.
Here is the log of my operation, be ware of that I have replaced my token in the log:
curl 'https://www.lingq.com/api/languages/en/10334/text/' -H 'Authorization: Token xxxxxxx' |more
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0<!DOCTYPE html>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="fb:page_id" content="47793958785">

This API works fine for me:
curl 'https://www.lingq.com/api/languages/en/lesson/?id=10334' -H 'Authorization: Token xxxxxx'
[{"id": 10334, "title": "#6 English Greetings and Goodbyes", "description": "Listen in as Steve and Kate talk about the different forms of greetings and goodbyes in English.", "shared_date": "2003-12-01", "level": "Intermediate 2", "provider": "EnglishLingQ ", "roses_received": 12, "image": "https://m.lingq.com/media/resources/contents/images/2007/04/16/greetings-120.jpg", "new_word_count": 0, "duration": 334}]

Thanks in advance.

@Richard_ - I ran this by one of our developers who had the following to say:

"He is receiving HTML instead of JSON because he is passing the incorrect url. He gets a 404 error, which he can see if he passes -i parameter to curl.
Actual url is https://www.lingq.com/api/languages/en/lessons/...

Hopefully this helps!

Hi alex,

It did help. The new API works now.
Maybe you can do some update on the LingQ API document: http://www.lingq.com/apidocs/api.html#methods
Because the document tells the "get lesson text" API is "GET https://www.lingq.com/api/languages/language/co..., and it doesn't work. The correct one is the one you give above.

Thanks.

@Richard_ - Ah, glad to hear it. I'll pass this along!

To comment login or sign up for a free account