Skip to content

Metadata API development

LarsTheGlidingSquirrel edited this page Apr 19, 2024 · 11 revisions

Introduction

The Serlo Metadata API, described for users at this page allows downloading the metadata of Serlo content. It is mainly used by content aggregators like

  • WirLernenOnline.de
  • Bildungsserver.de
  • edutags.de
  • NBP Datenraum (not yet publicly accessible?)

that we want to support via our Metadata API so that teachers and students can find Serlo content on those pages.

The type of content returned by the Metadata API currently includes applets, articles, courses, text exercises and exercise groups as well as video.

Format

The metadata is provided in a standardized format called Allgemeines Metadatenprofil für Bildungsressourcen (AMB) which translates to "general metadata profile for educational resources". Serlo is also involved in the AMB standard committee.

The AMB standard uses vocabulary from the Schema.org standard with JavaSript Object Notation Linked Data (JSON-LD) encoding. You can learn more about JSON-LD here.

Source

The core logic of the implementation is in https://github.com/serlo/database-layer/blob/main/server/src/metadata.rs with tests in https://github.com/serlo/database-layer/blob/main/server/tests/integration/metadata.rs.

The SQL query has a recursive part for two reasons. The first is to get the layer of taxonomy containing the subject, so we can map the Serlo subject to the right subject category given by the AMB standard. The second reason for the recursive query is that we want to exclude certain parts of Serlo in the metadata that are not useful to students. Examples for the things we want excluded are sandboxes, content not finished yet or the community area.

We currently have only images that we can use as thumbnail for 5 subjects and in German. For the others we display the default Serlo logo. This could be extended in the future.

Testing

To test your local changes to the Metadata API, you do not have to go through the Serlo API gateway. You can can send requests directly to the database-layer as described in the Readme like ./scripts/fetch.sh EntitiesMetadataQuery '{ "first": 100}'. Check here for additional optional arguments. Note that what is written in snake_case in the Rust file, has to be written camelCase in the JSON for the query.

Clone this wiki locally