From 180505cba4e9f54a382766361171e6e336460144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 14 Oct 2023 21:00:53 +0200 Subject: [PATCH] Improved API documentation on what will happen, if no Accept: header is set Related with issue #399 --- docs/api/intro.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/api/intro.md b/docs/api/intro.md index aca4bc49..8e60173a 100644 --- a/docs/api/intro.md +++ b/docs/api/intro.md @@ -60,6 +60,9 @@ to describe the data in a more structured way and also allows to link between di To get plain JSON without any metadata or links, use the `Accept: application/json` header. +Without an `Accept` header (e.g. when you call the endpoint in a browser), the API will return a HTML page with the documentation, so be sure to include the desired `Accept` header in your API requests. +If you can not control the `Accept` header, you can add an `.json` or `.jsonld` suffix to the URL to enforce a JSON or JSON-LD response (e.g. `/api/parts.jsonld`). + ## OpenAPI schema Part-DB provides a [OpenAPI](https://swagger.io/specification/) (formally Swagger) schema for the API under `/api/docs.json` (so `https://your-part-db.local/api/docs.json`).