Need help on LingQ API
Richard_ 3475
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/?...' -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/im...", "new_word_count": 0, "duration": 334}]

Thanks in advance.
February 2014
  • Moderator
    alex 1705 656 31848
    @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!
    February 2014
  • Moderator
    alex 1705 656 31848
    @Richard_ - Ah, glad to hear it. I'll pass this along!
    February 2014