GraphQL API - serlo/documentation GitHub Wiki
How to query Serlo content via GraphQL
We offer a GraphQL endpoint at https://api.serlo.orq/graphql in order to query Serlo content. For example to fetch data about the article https://serlo.org/1565 you can use:
curl -i -H 'Content-Type: application/json' -X POST \
-d '{"query": "query { uuid(id: 1565) { __typename }}"}' \
https://api.serlo.org/graphql
You can use the API playgroud at https://api.serlo.orq/___graphql to test your queries. There is also an embedded documentation for the schema.
How to query the content of a taxonomy terms
Serlo content is saved inside a taxonomy (tree of content areas). Given the ID of a taxonomy term (e.g. 134206
for https://de.serlo.org/community/134206/methodenkiste) you can traverse its children via the query:
{
uuid(id:134206) {
id
... on TaxonomyTerm {
children {
nodes {
id
__typename
title
}
}
}
}
}
The result looks like this:
{
"data": {
"uuid": {
"id": 134206,
"children": {
"nodes": [
{
"id": 126369,
"__typename": "Article",
"title": "Auditiver Lerntyp"
},
{
"id": 126373,
"__typename": "Article",
"title": "Kommunikativer Lerntyp"
},
{
"id": 134811,
"__typename": "Article",
"title": "Was ist die Methodenkiste?"
},
{
"id": 134638,
"__typename": "Article",
"title": "Was ist die Methodenkiste?"
},
{
"id": 136257,
"__typename": "Article",
"title": "Mindmap "
},
{
"id": 136677,
"__typename": "Article",
"title": "Möglichkeit durch das Programm \"Microsoft Power Point\""
},
{
"id": 134952,
"__typename": "Article",
"title": "Motivierter im Sport"
},
{
"id": 179565,
"__typename": "Course",
"title": "179565"
},
{
"id": 179566,
"__typename": "Course",
"title": "Wissenschaftliches Denken"
},
{
"id": 179704,
"__typename": "Course",
"title": "179704"
}
]
}
}
}
}