The Ediscio-API works according to REST specifications with BASIC authentication. Data are delivered as JSON and XML. It's crucial whether the header key "accept" has the value "application/xml" or "application/json". There are calls for listing all active cardboxes, downloading all flashcards of a cardbox, and for sending learning statistics to Ediscio.
Recommended tool for testing the API
- RESTClient A Java-bases GUI for REST interfaces
API-calls
List of all active cardboxes
http://www.ediscio.com/api/activecardboxes
delivers XML-data like:
<?xml version="1.0" encoding="UTF-8"?>
<cardBoxes>
<cardBox>
<cardBoxNbr>27</cardBoxNbr>
<cardBoxName><![CDATA[Französisch Grundlagen]]></cardBoxName>
<cardBoxDescription>
<![CDATA[<p>Französisch dès le
début - Französisch lernen von Anfang an.</p>
<p>Grundwortschatz zur Einführung.</p>]]>
</cardBoxDescription>
<folderKey>1</folderKey>
<folderName><![CDATA[Französisch]]></folderName>
<numOfCards>137</numOfCards>
<numOfLearned>114</numOfLearned>
</cardBox>
<cardBox>
<cardBoxNbr>79</cardBoxNbr>
<cardBoxName><![CDATA[Französisch Lektion 1]]></cardBoxName>
<cardBoxDescription><![CDATA[]]></cardBoxDescription>
<folderKey>1</folderKey>
<folderName><![CDATA[Französisch]]></folderName>
<numOfCards>87</numOfCards>
<numOfLearned>87</numOfLearned>
</cardBox>
</cardBoxes>
or as JSON:
{
"cardBoxes" : [ {
"cardBoxNbr" : 27,
"cardBoxName" : "<![CDATA[Französisch Grundlagen]]>",
"cardBoxDescription" : "<![CDATA[<p>Französisch dès le début
- Französisch lernen von Anfang an.</p><p>Grundwortschatz
zur Einführung.</p>]]>",
"folderKey" : 1,
"folderName" : "<![CDATA[Französisch]]>",
"numOfCards" : 136,
"numOfLearned" : 113
}, {
"cardBoxNbr" : 79,
"cardBoxName" : "<![CDATA[Französisch Lektion 1]]>",
"cardBoxDescription" : "<![CDATA[]]>",
"folderKey" : 1,
"folderName" : "<![CDATA[Französisch]]>",
"numOfCards" : 87,
"numOfLearned" : 87
} ]
}
Download all flashcards of a cardbox
http://www.ediscio.com/api/cardbox/x
Here, x is a cardBoxNbr (see above) - an example call could be:
http://www.ediscio.com/api/cardbox/27Result of a call in XML:
<?xml version="1.0" encoding="UTF-8"?>
<cardBox>
<card>
<cardNbr>18256</cardNbr>
<cardBoxNbr>27</cardBoxNbr>
<selectedForLearning>1</selectedForLearning>
<question><![CDATA[nach hause kommen/gehen]]></question>
<answer><![CDATA[rentrer]]></answer>
<questionImage/>
<answerImage/>
<questionSound/>
<answerSound/>
<created>2009-03-25 21:32:01</created>
<updated>2009-03-25 21:32:01</updated>
<timesKnown>2</timesKnown>
<timesNotKnown>0</timesNotKnown>
<knownInRow>2</knownInRow>
<lastPlayed>2010-04-01 23:22:26</lastPlayed>
<daystowait>0</daystowait>
</card>
<card>
<cardNbr>18255</cardNbr>
<cardBoxNbr>27</cardBoxNbr>
<selectedForLearning/>
<question><![CDATA[vorbeigehen, vorbeikommen]]></question>
<answer><![CDATA[passer]]></answer>
<questionImage/>
<answerImage/>
<questionSound/>
<answerSound/>
<created>2009-03-25 21:31:38</created>
<updated>2009-03-25 21:31:38</updated>
<timesKnown>4</timesKnown>
<timesNotKnown>0</timesNotKnown>
<knownInRow>4</knownInRow>
<lastPlayed>2009-08-14 13:49:55</lastPlayed>
<daystowait>0</daystowait>
</card>
</cardBox>
or as JSON:
{
"cardBox" : [ {
"cardNbr" : 18256,
"cardBoxNbr" : 27,
"selectedForLearning" : true,
"question" : "<![CDATA[nach hause kommen/gehen]]>",
"answer" : "<![CDATA[rentrer]]>",
"questionImage" : "",
"answerImage" : "",
"questionSound" : "",
"answerSound" : "",
"created" : "2009-03-25 21:32:01",
"updated" : "2009-03-25 21:32:01",
"timesKnown" : 2,
"timesNotKnown" : 0,
"knownInRow" : 2,
"lastPlayed" : "2010-04-01 23:22:26",
"daystowait" : 0
}, {
"cardNbr" : 18255,
"cardBoxNbr" : 27,
"selectedForLearning" : false,
"question" : "<![CDATA[vorbeigehen, vorbeikommen]]>",
"answer" : "<![CDATA[passer]]>",
"questionImage" : "",
"answerImage" : "",
"questionSound" : "",
"answerSound" : "",
"created" : "2009-03-25 21:31:38",
"updated" : "2009-03-25 21:31:38",
"timesKnown" : 4,
"timesNotKnown" : 0,
"knownInRow" : 4,
"lastPlayed" : "2009-08-14 13:49:55",
"daystowait" : 0
} ]
}
Sending learning statistics
http://www.ediscio.com/api/putstatistics
For sending statistics, a PUT method is used. Please note that the header key "accept" is also in this case crucial for the format of the sent data, thus it should have the value "application/xml" or "application/json".
The body of such a request should look like:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<statistics>
<cardStatistics>
<cardNbr>1523</cardNbr>
<known>1</known>
<dateTimeOfQuery>2010-04-30 17:30:55</dateTimeOfQuery>
</cardStatistics>
<cardStatistics>
<cardNbr>4523</cardNbr>
<known></known>
<dateTimeOfQuery>2010-04-30 17:34:55</dateTimeOfQuery>
</cardStatistics>
</statistics>JSON:
{
"statistics" : [ {
"cardNbr" : 18243,
"known" : true,
"dateTimeOfQuery" : "2010-04-30 17:30:55"
}, {
"cardNbr" : 18238,
"known" : true,
"dateTimeOfQuery" : "2010-05-01 12:15:40"
}, {
"cardNbr" : 4591,
"known" : false,
"dateTimeOfQuery" : "2010-05-01 12:17:34"
} ]
}
An answer looks like:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<status>
<accepted>1</accepted>
</status>JSON:
{
"status" : {
"accepted" : true
}
}



