Code-Schublade
2 min
code schublade docid\ bmw1amstx3defvlp0 p7i blöcke zeigen anfragebeispiele und antwortbeispiele in der rechten spalte eines zweispaltigen layouts an verwenden sie sie, um interaktive api dokumentation zu erstellen syntax sie können diese komponente entweder mit markdown oder mdx hinzufügen \ codedrawer{title="endpoint name"} \ codeblocktabsexamples (code blocks with request examples) \ \ codeblocktabsresponses (code blocks with response examples) \ \ \<codedrawer title="endpoint name"> \<codeblocktabsexamples> (code blocks with request examples) \</codeblocktabsexamples> \<codeblocktabsresponses> (code blocks with response examples) \</codeblocktabsresponses> \</codedrawer> eine code schublade besteht aus zwei abschnitten codeblocktabsexamples für anfragebeispiele codeblocktabsantworten für antwortbeispiele jeder abschnitt kann einen oder mehrere eingezäunte codeblöcke enthalten wenn mehrere codeblöcke vorhanden sind, werden sie automatisch in sprach tabs gruppiert code schubladen werden in der rechten spalte angezeigt, wenn sie innerhalb eines zweispaltigen layouts verwendet werden mdx beispiel das folgende beispiel erstellt eine code schublade mit anfragebeispielen in javascript, python und bash sowie erfolgreichen und fehlerantworten \<codedrawer title="create a user"> \<codeblocktabsexamples> ```javascript const response = await fetch('https //api example com/users', { method 'post', headers { 'content type' 'application/json', 'authorization' 'bearer sk live xxx' }, body json stringify({ name 'jane doe', email 'jane\@example com', role 'admin' }) }) const user = await response json() ``` ```python import requests response = requests post('https //api example com/users', json={ 'name' 'jane doe', 'email' 'jane\@example com', 'role' 'admin' }, headers={ 'authorization' 'bearer sk live xxx' }) user = response json() ``` ```bash curl x post https //api example com/users \\ h "content type application/json" \\ h "authorization bearer sk live xxx" \\ d '{"name" "jane doe","email" "jane\@example com","role" "admin"}' ``` \</codeblocktabsexamples> \<codeblocktabsresponses> ```json { "id" "usr abc123", "name" "jane doe", "email" "jane\@example com", "role" "admin", "createdat" "2026 04 01t10 00 00z" } ``` ```json { "error" "validation failed", "message" "email already exists", "code" 409 } ``` \</codeblocktabsresponses> \</codedrawer>
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.