Skip to content

Commit 4740c7e

Browse files
authored
Merge pull request #268 from dodona-edu/faq/api
Add FAQ about API
2 parents ae1dff6 + 71e1c9b commit 4740c7e

File tree

4 files changed

+93
-5
lines changed

4 files changed

+93
-5
lines changed

en/faq/api-tokens/index.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: API tokens
2+
title: API and API tokens
33
---
44

55
# FAQ: API tokens
@@ -26,3 +26,46 @@ Follow the steps below to create an API token on Dodona:
2626
::: tip
2727
Please note that for security reasons you will not be able to view the tokens on Dodona after creation. However, you can see a list of all your active tokens. You can delete a token at any time and it will stop working immediately.
2828
:::
29+
30+
## How can I use the Dodona API?
31+
32+
::: warning
33+
If you want to build an application, tool or plugin that uses the Dodona API, please contact us at [[email protected]](mailto:[email protected]) so we can help you out. This will also allow us to notify you if we make any changes to the API.
34+
:::
35+
36+
Many of the actions you can perform on Dodona can also be done through the API. Unfortunately, we do not have a complete documentation of the API yet. The easiest way to check if a certain action is possible through the API is to add `.json` to the end of the URL. For example, if you want to get a list of all the featured courses on Dodona, you can go to [dodona.ugent.be/courses.json?tab=featured](https://dodona.ugent.be/courses.json?tab=featured). This will return a JSON object with all the featured courses on Dodona.
37+
38+
For endpoints where you need to be signed in, you can use an [API token](#what-is-an-api-token) to authenticate. You can do this by adding the token to an `Authorization` header with your request:
39+
40+
```bash
41+
curl \
42+
-H "Authorization: {YOUR TOKEN}" \
43+
-H "Accept: application/json" \
44+
"https://dodona.ugent.be/nl/submissions.json"
45+
```
46+
47+
In Python, this would look like:
48+
49+
```python
50+
#!/usr/bin/python3
51+
# Name: Get submissions
52+
# By Robbert Gurdeep Singh
53+
######################################################################
54+
TOKEN = "TOKEN HERE"
55+
56+
57+
import http.client
58+
conn = http.client.HTTPSConnection("dodona.ugent.be")
59+
headers = {
60+
"Content-type": "application/json",
61+
"Accept": "application/json",
62+
"Authorization" : TOKEN
63+
}
64+
65+
conn.request("GET", "/en/submissions.json", headers=headers)
66+
res = conn.getresponse()
67+
print(res.status, res.reason)
68+
data = res.read()
69+
conn.close()
70+
print(data)
71+
```

en/faq/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ title: Frequently Asked Questions
55

66
In this FAQ section you will find answers to the most frequently asked questions about using Dodona. Whether you're a student trying to understand how to navigate through lessons, a teacher setting up a new course, or just curious about certain features, we've got you covered. To find a specific page, our search function in the top navigation bar is really powerful. If you can't find the answer to your question, don't hesitate to contact [our support team](https://dodona.be/en/contact).
77

8-
## API tokens
8+
## API and API tokens
99
- [What is an API token?](./api-tokens/#what-is-an-api-token)
1010
- [How do I create an API token?](./api-tokens/#how-do-i-create-an-api-token)
11+
- [How can I use the Dodona API?](./api-tokens/#how-can-i-use-the-dodona-api)
1112

1213
## Featured courses
1314
- [What is a featured courses?](./featured-courses/#what-is-a-featured-course)

nl/faq/api-tokens/index.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: API tokens
2+
title: API en API tokens
33
---
44

5-
# FAQ: API tokens
5+
# FAQ: API en API tokens
66

77
[[toc]]
88

@@ -26,3 +26,46 @@ Volg de onderstaande stappen om een API token aan te maken op Dodona:
2626
::: tip
2727
Houd er rekening mee dat je om veiligheidsredenen de tokens niet kunt bekijken op Dodona nadat ze zijn aangemaakt. Je kunt echter wel een lijst van al je actieve tokens bekijken. Je kunt een token op elk moment verwijderen en het zal onmiddellijk stoppen met werken.
2828
:::
29+
30+
## Hoe kan ik de Dodona API gebruiken?
31+
32+
::: warning
33+
Als je een applicatie, tool of plugin wilt bouwen die de Dodona API gebruikt, neem dan contact met ons op via [[email protected]](mailto:[email protected]) zodat we je kunnen helpen. Zo kunnen we je ook op de hoogte brengen als we de API wijzigen.
34+
:::
35+
36+
Veel van de acties die je kunt uitvoeren op Dodona kunnen ook worden gedaan via de API. Helaas hebben we nog geen volledige documentatie van de API. De eenvoudigste manier om te controleren of een bepaalde actie mogelijk is via de API is door `.json` toe te voegen aan het einde van de URL. Als je bijvoorbeeld een lijst wilt van alle uitgelichte cursussen op Dodona, kun je naar [dodona.ugent.be/courses.json?tab=featured](https://dodona.ugent.be/courses.json?tab=featured) gaan. Dit geeft een JSON-object met alle uitgelichte cursussen op Dodona.
37+
38+
Voor endpoints waar je voor ingelogd moet zijn, kan je een [API token](#wat-is-een-api-token) gebruiken om je te authenticeren. Dit kan je doen door het token toe te voegen aan een `Authorization` header bij je request:
39+
40+
```bash
41+
curl \
42+
-H "Authorization: {YOUR TOKEN}" \
43+
-H "Accept: application/json" \
44+
"https://dodona.ugent.be/nl/submissions.json"
45+
```
46+
47+
In Python ziet dit er als volgt uit:
48+
49+
```python
50+
#!/usr/bin/python3
51+
# Name: Get submissions
52+
# By Robbert Gurdeep Singh
53+
######################################################################
54+
TOKEN = "TOKEN HERE"
55+
56+
57+
import http.client
58+
conn = http.client.HTTPSConnection("dodona.ugent.be")
59+
headers = {
60+
"Content-type": "application/json",
61+
"Accept": "application/json",
62+
"Authorization" : TOKEN
63+
}
64+
65+
conn.request("GET", "/nl/submissions.json", headers=headers)
66+
res = conn.getresponse()
67+
print(res.status, res.reason)
68+
data = res.read()
69+
conn.close()
70+
print(data)
71+
```

nl/faq/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ title: Frequently Asked Questions
66
In deze FAQ-sectie vind je antwoorden op de meest gestelde vragen over het gebruik van Dodona. Of je nu een leerling bent die probeert te begrijpen hoe je door de lessen moet navigeren, een docent die een nieuwe cursus opzet of gewoon nieuwsgierig bent naar bepaalde functies, wij hebben het voor je geregeld. Om een specifieke pagina te vinden, is onze zoekfunctie in de navigatiebalk bovenaan erg krachtig. Als je het antwoord op je vraag niet kunt vinden, aarzel dan niet om contact op te nemen met [ons ondersteuningsteam](https://dodona.be/nl/contact).
77

88

9-
## API tokens
9+
## API en API tokens
1010
- [Wat is een API token?](./api-tokens/#wat-is-een-api-token)
1111
- [Hoe maak ik een API token aan?](./api-tokens/#hoe-maak-ik-een-api-token-aan)
12+
- [Hoe kan ik de Dodona API gebruiken?](./api-tokens/#hoe-kan-ik-de-dodona-api-gebruiken)
1213

1314
## IDE plugins
1415
- [Wat is een IDE plugin?](./ide-plugins/#wat-is-een-ide-plugin)

0 commit comments

Comments
 (0)