LingQ API

A Fun Little Exercise to Familiarize People with RESTful APIs: <–(I’m American, so we spell it familiariZe)

RESTful APis are basically just HTTP GETs, POSTs, and PUTs to urls where the response it read by a computer program rather than a web browser (which is also a computer program but that’s not important to this discussion).

However, because the interface to a RESTful API is simply HTTP protocol, you can use your web browser (Firefox, IE, Chrome, etc) to explore how specific API’s work, as we will do here with the LingQ API, simply by surfing to the LingQ API’s urls.

The first thing the LingQ API documentation specifies you do is retrieve your APIKey, this can simply be done by going here: Login - LingQ
Copy your APIKey to Notepad or somewhere you can retrieve it easily. For the sake of example say your APIKey is ABC123 (in reality your specific APIKey will be a very large hexadecimal number comprised of a bunch of digits and any number of letters between a and f).

This APIKey will be used as a parameter in subsequent LingQ API calls. First you will want to see the codes for the languages you currently study.

In the address bar to your web browser put in this url: http://www.lingq.com/api_v2/languages/?format=xml&apikey=ABC123
Remember to put in your actual APIKey, not ABC123

You will see something that looks like this:

it
en
es

These are LingQs language codes for languages you are studying. In my example, we see the codes for Italian, English, and Spanish respectively.

Pick a language code that you have a good amount of LingQs for for use with this next example.

We are going to show you all of your LingQs for a specific language. For this example I will use “it” for Italian

In your web browser, put this url in the address bar: http://www.lingq.com/api_v2/it/lingqs/?format=xml&apikey=ABC123

Notice the segment /api_v2/it/lingqs of the url, here you must replace “it” with the language code of your choice, and remember to put in your proper APIKey.

You will see something that looks like this:

0

primario, accusato anche di truffa e falso, anche se

truffa
4073703
fraud, swindle, cheat, fiddle, do, racket, hoax


0

rimborsi e lui ne traesse «un vantaggio economico in

traesse
4073700
v. derive, draw, pull, get; take; bring

These are your LingQs listed in xml format, with various information about them, such as the LingQ’s id, so it can be referenced in other LingQ API messages.

Now that you have got your feet wet in the workings of RESTful APIs, you can go to the LingQ documentation page and play around with other things like getting lists of your lessons and lists of your LingQs per lesson. Neat eh?

@ odiernod: Thank you for pointing out that the API has changed!

I would also be interested to know the answer to your question. I hope our apiKeys won’t change more more frequently than the API itself :wink: .

And now, with the Login dropped, it became easier to start toying, at least in my favorite dev. environment, in which the secure login was a problem.

@ jmv and everybody. I’ve tested all the methods but the last, which requires the http PUT method to update the lingQs. My favorite environment (neither Pithon nor .Net) would not support PUT without a headache, but only the GET and POST. May be there any workaround ?

@odiernod:
The keys doesn’t change and doesn’t expire, although they could be disabled on an individual basis if someone will abuse the API somehow.

Thanks for the quick answer jmv. We shall http GET anyone who will abuse the API and PUT them to prison. Never mined my question about the POST. I have found the way to support PUT ;-).

I m using .net environment too. But without being able to retrieve the text of a lesson, at least, there is not much things to work on. I mean apart from interface. I for once, given the available apis, I would start with making a vocabulary with different paging. Lesson’s paging/listing too.

For any developers who would like to work on a project while having a the API work abstracted for them, I’m crafting a ruby gem that wraps the API with httparty. I’m planning on using it myself for my own Mac desktop client, but it’s released under the MIT license so have at it.

If you just want the gem, it’s hosted on rubygems.org as “lingq”, install with “sudo gem install lingq”.

If you want to clone the source, it’s hosted on my github account: GitHub - evizitei/lingq: API Wrapper for Lingq.com

limited docs available in the readme file.

Thank you eviztei. I hope many people take advantage.

I love tags, but it seems LingQ team is not going to develop tag functionality. Perhaps, it is possible to add tags in “LingQs List” and “Update LingQ” API?

We do hope to gradually expand our API’s. Please be patient as we try to juggle all the different feature requests.

I’m trying to put this string into the address bar of my browser “http://www.lingq.com/api_v2/languages/?format=xml&%20apikey = ABC” (in fact i’m typing not ABC, but my really API key, which i have taken on Login - LingQ ). And after all, i see “Authorization Required”.
Please tell me, why is it so? I have no experience in web-programming, but have a good practical experience in Windows programming using C# and ObjectPascal, and it is simply interesting for me to make some very simple app with your API.

Amorfis, I think the problem is that you have to delete the space character between “xml” and “&”

Well in fact, after trying it in the browser, if you don’t delete the space character, the browse changes a little the url (it adds %20).

So better you try again with the original url:
http://www.lingq.com/api_v2/languages/?format=xml&apikey=ABC123
But deleting all space characters.

Space characters appear because when you post something in the forum, sometimes large urls doesn’t appear correctly.

Thank you Oscar! Your message was very usefull for me. Now it’s ok

I want to play with LIngQ API, but in fact there are too little methods.

I would like to have the following API-methods:

  • get the list of discussions I signed in. I would like to get the following data in the discussion record: discussion_id, discussion_title, language, tutor, date&time
  • get the list of discussions I host with at least 1 signed participant
  • get the list of participants by discussion_id
  • get the list of tutors providing discussions for a given language
  • get the list of available 1-on-1 discussions for a given tutor in a given language for a given period (if tutor is not defined — for all tutors. By ‘period’ I mean period of dates: i.e. 04-Mar-2011 — 06-Mar-2011)
  • get the list of available group discussions for a given tutor in a given language for a given period (if a tutor is not defined, for all tutors)

Time zone of returned time is supposed to be UTC, GMT, or any other specified by API method documentation :slight_smile:

Expanded wishlist:

  • get the list of available group discussions with a given participant
  • get the list of submitted writings (offtop: oh no, I still have not returned writing to Daniel!)

April 26, 2010 14:07 Cakypa
I would like to have some API for updating statistics (Words of Reading, Words of Writing, Hours of Listening, Hours of Speaking)
I still want it :slight_smile:

Another thing that would be fantastic is :
get the list of links to the lessons in one language, with the category, level, type, accent and provider.
Could it be possible?

Some day I would like to try to make a customized searcher with that.

Won’t this list be very-very-very-very-very-very long for some languages?

Agree, Cakipa. Maybe it should be filtered first by some parameters.
The first idea was to get all the lessons of one language, and then do some search with that information locally. Much faster, much easier.

I will bump this thread until someone from LingQ HQwrites in this thread and promises to implement it (or rejects)

Hi Rasana,

We saw your post, don’t worry. :slight_smile: I’m not entirely familiar with the API, so I’ll have to defer to Mark on this one. He just got back from Europe today, so he should be able to give you a more detailed answer over the next few days of whether or not this is possible.