forked from WEB-IB-SS26/development-ib
Compare commits
5 Commits
17cd1cee65
...
20691f5d4f
| Author | SHA1 | Date |
|---|---|---|
|
|
20691f5d4f | |
|
|
d28c272ef6 | |
|
|
cfb847341f | |
|
|
0d66021e91 | |
|
|
9331b0fd05 |
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Login</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Kundenkonto</h1>
|
||||||
|
<form action="" method="get">
|
||||||
|
<h2>Melden Sie sich bitte an:</h2>
|
||||||
|
<label for="email">E-Mail:</label>
|
||||||
|
<input type="email" id="email" name="email" required>
|
||||||
|
<br><br>
|
||||||
|
<label for="password">Passwort:</label>
|
||||||
|
<input type="password" id="password" name="pwd" required>
|
||||||
|
<br><br>
|
||||||
|
<input type="submit" value="Login">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Obstbestellung</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Bestellen Sie sich Ihr Obst direkt nach Hause!</h1>
|
||||||
|
<form action="" method="get">
|
||||||
|
<label for="obst">Wählen Sie Ihr Obst:</label>
|
||||||
|
<input list="obstliste" id="obst" name="obst">
|
||||||
|
<datalist id="obstliste">
|
||||||
|
<option value="Apfel">
|
||||||
|
<option value="Banane">
|
||||||
|
<option value="Kirsche">
|
||||||
|
<option value="Mango">
|
||||||
|
<option value="Orange">
|
||||||
|
<option value="Pfirsich">
|
||||||
|
</datalist>
|
||||||
|
<br><br>
|
||||||
|
<label for="anzahl">Geben Sie die gewünschte Stückzahl an:</label>
|
||||||
|
<input type="number" id="anzahl" name="anzahl" min="1" max="10" step="1" required>
|
||||||
|
<br><br>
|
||||||
|
<label for="boxcolor">Wählen Sie die gewünschte Farbe Ihrer Obstbox:</label>
|
||||||
|
<input type="color" id="boxcolor" name="obstboxfarbe" value="#ff0000">
|
||||||
|
<br><br>
|
||||||
|
<input type="submit" value="Bestellen">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Workshop-Anmeldung</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form action="https://web-637691723779.europe-west2.run.app/registrierung" method="post">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Persönliche Angaben:</legend>
|
||||||
|
<label for="vorname">Vorname:</label><br>
|
||||||
|
<input type="text" name="vorname" id="vorname" placeholder="Vorname"><br>
|
||||||
|
|
||||||
|
<label for="nachname">Nachname:</label><br>
|
||||||
|
<input type="text" name="nachname" id="nachname" placeholder="Nachname"><br>
|
||||||
|
|
||||||
|
<label for="email">E-Mail:</label><br>
|
||||||
|
<input type="email" name="email" id="email" autocomplete="email"><br>
|
||||||
|
|
||||||
|
<label for="telefon">Handynummer:</label><br>
|
||||||
|
<input type="tel" name="telefon" id="telefon" pattern="^01[5-7][0-9]{7,10}$"><br><br>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Kursauswahl:</legend>
|
||||||
|
<label for="kurs">Kurs:</label><br>
|
||||||
|
<input type="text" name="kurs" id="kurs" value="Webentwicklung Basics" disabled><br><br>
|
||||||
|
|
||||||
|
<label for="sessions">Bevorzugte Session:</label><br>
|
||||||
|
<select id="sessions" name="sessions" multiple size="4">
|
||||||
|
<option value="vormittag">Vormittag</option>
|
||||||
|
<option value="nachmittag">Nachmittag</option>
|
||||||
|
<option value="abendsession">Abend</option>
|
||||||
|
<option value="wochenende">Wochenende</option>
|
||||||
|
</select><br>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Zusätzliche Optionen:</legend>
|
||||||
|
<input type="checkbox" id="agb" name="agb" required>
|
||||||
|
<label for="agb">Ich akzeptiere die Teilnahmebedingungen.</label><br>
|
||||||
|
|
||||||
|
<input type="checkbox" id="newsletter" name="newsletter" value="ja">
|
||||||
|
<label for="newsletter">Newsletter abonnieren.</label><br>
|
||||||
|
|
||||||
|
<input type="checkbox" id="equipment" name="equipment" value="ja">
|
||||||
|
<label for="equipment">Ich benötige spezielles Equipment.</label><br>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Teilnahmeformat:</legend>
|
||||||
|
Format wählen:<br>
|
||||||
|
<input type="radio" id="online" name="format" value="online" required>
|
||||||
|
<label for="online">Online</label><br>
|
||||||
|
|
||||||
|
<input type="radio" id="praesenz" name="format" value="praesenz">
|
||||||
|
<label for="praesenz">Präsenz</label><br>
|
||||||
|
</fieldset>
|
||||||
|
<br>
|
||||||
|
<input type="submit" value="Jetzt anmelden">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
## Demo XML
|
||||||
|
|
||||||
|
curl -L https://www.tagesschau.de/xml/rss2 -o tagesschau.xml
|
||||||
|
|
||||||
|
## Demo JSON
|
||||||
|
|
||||||
|
curl https://hp-api.onrender.com/api/characters/staff -o harrypotter.json
|
||||||
|
|
||||||
|
oder
|
||||||
|
|
||||||
|
curl https://pokeapi.co/api/v2/pokemon/pikachu -o pokemon.json
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Flowers API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/yellow-flowers": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Fetches a list of yellow flowers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"example": 4
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Mädchenauge"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Flowers API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/yellow-flowers": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Fetches a list of yellow flowers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Flower"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/blue-flowers": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Fetches a list of blue flowers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/Flower"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Flower": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"example": 4
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Mädchenauge"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Hello API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/hello": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Begrüßt jeden mit Namen oder die Welt",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"in": "query",
|
||||||
|
"required": true,
|
||||||
|
"description": "Name der zu begrüßenden Person",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Farhad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Erfolgreiche Antwort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Hello API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/hello": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Begrüßt jeden",
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Zoya"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Erfolgreiche Antwort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Hello API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/hello": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Begrüßt jeden",
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Zoya"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Erfolgreiche Antwort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Simple Greeting API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/hello": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Returns a greeting",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"in":"query",
|
||||||
|
"required": true,
|
||||||
|
"description": "Name Parameter",
|
||||||
|
"schema":{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Mr. X"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Greeting response in plain text.",
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Hello!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"summary": "Returns a plain text greeting",
|
||||||
|
"requestBody":{
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"text/plain":{
|
||||||
|
"schema":{
|
||||||
|
"type": "string",
|
||||||
|
"example": "YEET"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Plain text greeting response",
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Hello!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/hello-json":{
|
||||||
|
"post":{
|
||||||
|
"summary": "Ein hello/json greeting",
|
||||||
|
"requestBody":{
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json":{
|
||||||
|
"schema":{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name":{
|
||||||
|
"type":"string",
|
||||||
|
"example":"Alice"
|
||||||
|
},
|
||||||
|
"age":{
|
||||||
|
"type":"integer",
|
||||||
|
"example":"23"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "age"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Json text greeting response",
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Daten erhalten!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
## Frage 1:
|
||||||
|
Frage: Welchen Usernamen benutzt Ervin Howell?
|
||||||
|
|
||||||
|
Antwort: Antonette
|
||||||
|
## Frage 2:
|
||||||
|
Frage: Wieviele Posts wurden von dem/der Nutzer:in mit der User-ID 6 gespeichert?
|
||||||
|
|
||||||
|
Antwort: 10 Stück
|
||||||
|
## Frage 3:
|
||||||
|
Frage: Wie lautet der Titel des Posts mit der ID 1?
|
||||||
|
|
||||||
|
Antwort: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
|
||||||
|
## Frage 4:
|
||||||
|
Frage: Wieviele Kommentare hat der Post mit der ID 1 erhalten?
|
||||||
|
|
||||||
|
Antwort: 5 Kommentare
|
||||||
|
## Frage 5:
|
||||||
|
Frage: Gibt es andere Posts (außer PostId 1), die Kommentare erhalten haben? (Ja/Nein)
|
||||||
|
|
||||||
|
Antwort: JA (insgesammt 500 Kommentare)
|
||||||
|
## Frage 6:
|
||||||
|
Frage: Wie finde ich alle Posts, die von dem/der Nutzer:in mit der User-ID 2 gespeichert wurden?
|
||||||
|
|
||||||
|
Antwort: Mit dem Befehl: "curl https://jsonplaceholder.typicode.com/posts/2/comments"
|
||||||
|
(Es sind 5 Kommentare)
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
## Arbeitsschritt 1:
|
||||||
|
Arbeitsschritt: Finden Sie die ID von Professor Firenze heraus. Welchen curl-Befehl haben Sie verwendet?
|
||||||
|
|
||||||
|
Antwort: Die ID von Firenze ist "68eb4a0b-6c49-44e9-aec8-5af947d22141"
|
||||||
|
Der ensprechende Befehl ist: "curl -s https://hp-api.onrender.com/api/characters/staff"
|
||||||
|
|
||||||
|
|
||||||
|
## Arbeitsschritt 2&3:
|
||||||
|
|
||||||
|
Arbeitsschritt: Nutzen Sie diese ID, um ausschließlich die Informationen zu Professor Firenze zu finden. Welchen curl-Befehl haben Sie verwendet?
|
||||||
|
|
||||||
|
Antwort: "curl -s https://hp-api.onrender.com/api/character/68eb4a0b-6c49-44e9-aec8-5af947d22141"
|
||||||
|
Er hat die Haarfarbe blond.
|
||||||
|
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
## Arbeitsschritt 1:
|
||||||
|
Arbeitsschritt iv:
|
||||||
|
Formulieren Sie einen eigenen POST-Request für:
|
||||||
|
Name: Sonnenhut
|
||||||
|
Botanischer Name: Echinacea purpurea
|
||||||
|
Standort: Sonnig
|
||||||
|
Besonderheiten: Heilpflanze, zieht Schmetterlinge an, robust
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
curl -X POST https://crudcrud.com/api/${API_ID}/staudenpflanzen \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Sonnenhut", "botanischer_name": "Echinacea purpurea", "standort": "Sonnig", "besonderheiten": "Heilpflanze, zieht Schmetterlinge an, robust"}'
|
||||||
|
|
||||||
|
|
||||||
|
Arbeitsschritt v:
|
||||||
|
Formulieren Sie einen eigenen POST-Request für:
|
||||||
|
Name: Tränendes Herz
|
||||||
|
Botanischer Name: Lamprocapnos spectabilis
|
||||||
|
Standort: Halbschatten
|
||||||
|
Besonderheiten: Herzförmige Blüten, romantisch, giftig
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
Antwort:
|
||||||
|
curl -X POST https://crudcrud.com/api/${API_ID}/staudenpflanzen \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Tränendes Herz", "botanischer_name": "Lamprocapnos spectabilis", "standort": "Halbschatten", "besonderheiten": "Herzförmige Blüten, romantisch, giftig"}'
|
||||||
|
|
||||||
|
## Arbeitsschritt 2:
|
||||||
|
|
||||||
|
Arbeitsschritt i:
|
||||||
|
curl https://crudcrud.com/api/${API_ID}/staudenpflanzen
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
[{"_id":"69e663a4ee62c203e8570037","name":"Lavendel","botanischer_name":"Lavandula angustifolia","standort":"Sonnig, trocken","besonderheiten":"Duftend, bienenfreundlich, winterhart"},{"_id":"69e663c0ee62c203e8570038","name":"Lavendel","botanischer_name":"Lavandula angustifolia","standort":"Sonnig, trocken","besonderheiten":"Duftend, bienenfreundlich, winterhart"},{"_id":"69e66501ee62c203e8570039","name":"Tränendes Herz","botanischer_name":"Lamprocapnos spectabilis","standort":"Halbschatten","besonderheiten":"Herzförmige Blüten, romantisch, giftig"},{"_id":"69e6651cee62c203e857003a","name":"Sonnenhut","botanischer_name":"Echinacea purpurea","standort":"Sonnig","besonderheiten":"Heilpflanze, zieht Schmetterlinge an, robust"}]
|
||||||
|
|
||||||
|
|
||||||
|
Arbeitsschritt ii:
|
||||||
|
Finden Sie die IDs der Funkie, des Sonnenhuts und der Pfingstrose heraus und notieren Sie sich diese.
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
Funkie: "69e666dbee62c203e857003c"
|
||||||
|
Sonnenhut: "69e6651cee62c203e857003a"
|
||||||
|
Pfingstrose: "69e666e9ee62c203e857003d"
|
||||||
|
|
||||||
|
## Arbeitsschritt 3:
|
||||||
|
|
||||||
|
Arbeitsschritt i:
|
||||||
|
curl -X PUT https://crudcrud.com/api/${API_ID}/staudenpflanzen/<id> \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Sonnenhut", "botanischer_name": "Echinacea purpurea", "standort": "Sonnig", "besonderheiten": "Heilpflanze, zieht Schmetterlinge, schneckenanfällig"}'
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
curl -X PUT https://crudcrud.com/api/${API_ID}/staudenpflanzen/69e6651cee62c203e857003a \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Sonnenhut", "botanischer_name": "Echinacea purpurea", "standort": "Sonnig", "besonderheiten": "Heilpflanze, zieht Schmetterlinge, schneckenanfällig"}'
|
||||||
|
|
||||||
|
Antwort des Servers mit "curl https://crudcrud.com/api/${API_ID}/staudenpflanzen":
|
||||||
|
...
|
||||||
|
{"_id":"69e6651cee62c203e857003a","name":"Sonnenhut","botanischer_name":"Echinacea purpurea","standort":"Sonnig","besonderheiten":"Heilpflanze, zieht Schmetterlinge, schneckenanfällig"}
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
Arbeitsschritt ii:
|
||||||
|
Formulieren Sie einen eigenen PUT-Request für die Funkie und ändern Sie die Besonderheiten zu "Dekoratives Laub, schneckenanfällig, robust".
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
curl -X PUT https://crudcrud.com/api/${API_ID}/staudenpflanzen/69e666dbee62c203e857003c \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name":"Funkie","botanischer_name":"Hosta","standort":"Halbschatten bis Schatten","besonderheiten":"Dekoratives Laub, schneckenanfällig, robust"}'
|
||||||
|
|
||||||
|
Antwort des Servers mit "curl https://crudcrud.com/api/${API_ID}/staudenpflanzen":
|
||||||
|
...
|
||||||
|
{"_id":"69e666dbee62c203e857003c","name":"Funkie","botanischer_name":"Hosta","standort":"Halbschatten bis Schatten","besonderheiten":"Dekoratives Laub, schneckenanfällig, robust"}
|
||||||
|
...
|
||||||
|
|
||||||
|
## Arbeitsschritt 4:
|
||||||
|
|
||||||
|
Arbeitsschritt i:
|
||||||
|
curl -X DELETE https://crudcrud.com/api/${API_ID}/staudenpflanzen/69e666e9ee62c203e857003d
|
||||||
|
|
||||||
|
|
||||||
|
## Arbeitsschritt 5:
|
||||||
|
|
||||||
|
Arbeitsschritt:
|
||||||
|
curl https://crudcrud.com/api/${API_ID}/staudenpflanzen | jq
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"_id":"69e663a4ee62c203e8570037",
|
||||||
|
"name":"Lavendel",
|
||||||
|
"botanischer_name":"Lavandula angustifolia",
|
||||||
|
"standort":"Sonnig, trocken",
|
||||||
|
"besonderheiten":"Duftend, bienenfreundlich, winterhart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id":"69e663c0ee62c203e8570038",
|
||||||
|
"name":"Lavendel",
|
||||||
|
"botanischer_name":"Lavandula angustifolia",
|
||||||
|
"standort":"Sonnig, trocken",
|
||||||
|
"besonderheiten":"Duftend, bienenfreundlich, winterhart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id":"69e66501ee62c203e8570039",
|
||||||
|
"name":"Tränendes Herz",
|
||||||
|
"botanischer_name":"Lamprocapnos spectabilis",
|
||||||
|
"standort":"Halbschatten",
|
||||||
|
"besonderheiten":"Herzförmige Blüten, romantisch, giftig"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id":"69e6651cee62c203e857003a",
|
||||||
|
"name":"Sonnenhut",
|
||||||
|
"botanischer_name":"Echinacea purpurea",
|
||||||
|
"standort":"Sonnig",
|
||||||
|
"besonderheiten":"Heilpflanze, zieht Schmetterlinge, schneckenanfällig"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id":"69e666dbee62c203e857003c",
|
||||||
|
"name":"Funkie",
|
||||||
|
"botanischer_name":"Hosta",
|
||||||
|
"standort":"Halbschatten bis Schatten",
|
||||||
|
"besonderheiten":"Dekoratives Laub, schneckenanfällig, robust"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
## Arbeitsschritt 1:
|
||||||
|
Arbeitsschritt:
|
||||||
|
Erstelle ein JSON-Objekt mit Informationen über eine Person:
|
||||||
|
Name: Alex
|
||||||
|
Alter: 30
|
||||||
|
Wohnort: Berlin
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
{
|
||||||
|
"person": {
|
||||||
|
"name": "Alex",
|
||||||
|
"alter": "30",
|
||||||
|
"wohnort": "Berlin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Arbeitsschritt 2:
|
||||||
|
|
||||||
|
Arbeitsschritt:
|
||||||
|
Erstelle ein JSON-Objekt zu einem Produkt:
|
||||||
|
Produktname: Kopfhörer
|
||||||
|
Preis: 89.99
|
||||||
|
Verfügbarkeit: Ja
|
||||||
|
Farben: Schwarz und Weiß (als Liste)
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
{
|
||||||
|
"produkt":{
|
||||||
|
"produktname": "Kopfhöhrer",
|
||||||
|
"preis": "89.99",
|
||||||
|
"verfügbarkeit": "ja",
|
||||||
|
"farben":[
|
||||||
|
"schwarz",
|
||||||
|
"weiss"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Arbeitsschritt 3:
|
||||||
|
|
||||||
|
Arbeitsschritt:
|
||||||
|
Erstelle ein JSON-Objekt zu einem Benutzer inklusive Adresse:
|
||||||
|
Benutzername: maria1999
|
||||||
|
Passwort: abc123
|
||||||
|
Rolle: Admin
|
||||||
|
Adresse: Bauernring 15 (Straße), Weilbach (Stadt) und 12345 (Postleitzahl) (als verschachteltes Objekt)
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
{
|
||||||
|
"benutzer":{
|
||||||
|
"benutzername":"maria1999",
|
||||||
|
"passwort":"abc123",
|
||||||
|
"rolle":"admin",
|
||||||
|
"addresse":{
|
||||||
|
"straße": "Bauernring 15",
|
||||||
|
"stadt": "Weilbach",
|
||||||
|
"postleitzahl": "12345"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## Arbeitsschritt 4:
|
||||||
|
|
||||||
|
Arbeitsschritt:
|
||||||
|
Erstelle ein Array mit zwei Aufgabenobjekten. Jede Aufgabe hat einen Titel und einen erledigt-Status (true/false)
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
{
|
||||||
|
"aufgaben": [
|
||||||
|
"aufgabe":{
|
||||||
|
"titel": "JSON Lernen",
|
||||||
|
"erledigt":"true"
|
||||||
|
},
|
||||||
|
"aufgabe":{
|
||||||
|
"titel": "SWAGGER Lernen",
|
||||||
|
"erledigt":"false"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Arbeitsschritt 5:
|
||||||
|
|
||||||
|
Arbeitsschritt:
|
||||||
|
Erstelle ein JSON-Objekt für einen Blogeintrag mit folgendem Aufbau:
|
||||||
|
Titel, Autor, Inhalt des Beitrags
|
||||||
|
Ein Kommentar als verschachteltes Objekt mit Autor und Text
|
||||||
|
|
||||||
|
Antwort:
|
||||||
|
{
|
||||||
|
"blogeintrag":{
|
||||||
|
"titel": "Ein Test Titel",
|
||||||
|
"autor": "Mr X.",
|
||||||
|
"inhalt": "Lorem ipsum ...",
|
||||||
|
"kommentar": {
|
||||||
|
"autor": "Kommentator von dem Blogeintrag",
|
||||||
|
"text": "Lorem ipsum..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,169 @@
|
||||||
|
# Übungsblatt 05
|
||||||
|
|
||||||
|
## 1. REST-API-Übung: GET
|
||||||
|
|
||||||
|
**Aufgabenstellung**:
|
||||||
|
Nutzen Sie die frei zugängliche Test-API _[JSONPlaceholder](https://jsonplaceholder.typicode.com)_ für erste Rest-API-Anfragen.
|
||||||
|
|
||||||
|
#### Vorbereitung
|
||||||
|
- Öffnen Sie ein Terminal (macOS/Linux) oder PowerShell/CMD (Windows).
|
||||||
|
- Prüfen Sie, ob `curl` installiert ist:
|
||||||
|
`curl --version`
|
||||||
|
|
||||||
|
#### Arbeitsschritte
|
||||||
|
|
||||||
|
1. Führen Sie einfache GET-Requests aus und beantworten Sie die Fragen:
|
||||||
|
1. `curl https://jsonplaceholder.typicode.com/users`
|
||||||
|
- *Frage*: Welchen Usernamen benutzt Ervin Howell?
|
||||||
|
2. `curl https://jsonplaceholder.typicode.com/posts`
|
||||||
|
- *Frage*: Wieviele Posts wurden von dem/der Nutzer:in mit der User-ID 6 gespeichert?
|
||||||
|
3. `curl https://jsonplaceholder.typicode.com/posts/1`
|
||||||
|
- *Frage*: Wie lautet der Titel des Posts mit der ID 1?
|
||||||
|
4. `curl https://jsonplaceholder.typicode.com/posts/1/comments`
|
||||||
|
- *Frage*: Wieviele Kommentare hat der Post mit der ID 1 erhalten?
|
||||||
|
5. `curl https://jsonplaceholder.typicode.com/comments`
|
||||||
|
- *Frage*: Gibt es andere Posts (außer PostId 1), die Kommentare erhalten haben? (Ja/Nein)
|
||||||
|
6. *Frage*: Wie finde ich alle Posts, die von dem/der Nutzer:in mit der User-ID 2 gespeichert wurden?
|
||||||
|
|
||||||
|
## 2. REST-API-Übung: GET
|
||||||
|
|
||||||
|
**Aufgabenstellung**:
|
||||||
|
Nutzen Sie die frei zugängliche Test-API [HP-API (Harry Potter API)](https://hp-api.onrender.com) für weitere Rest-API-Anfragen.
|
||||||
|
|
||||||
|
#### Arbeitsschritte:
|
||||||
|
1. Finden Sie die ID von Professor Firenze heraus. Welchen `curl`-Befehl haben Sie verwendet?
|
||||||
|
2. Nutzen Sie diese ID, um ausschließlich die Informationen zu Professor Firenze zu finden. Welchen `curl`-Befehl haben Sie verwendet?
|
||||||
|
3. Welche Haarfarbe hat er?
|
||||||
|
|
||||||
|
## 3. REST-API-Übung: POST, PUT, PATCH, DELETE
|
||||||
|
|
||||||
|
**Aufgabenstellung**:
|
||||||
|
Nutzen Sie die limitiert zugängliche Test-API [_crudcrud_](https://crudcrud.com) für weitere Rest-API-Anfragen.
|
||||||
|
|
||||||
|
_Hinweis: Beachten Sie den mitgelieferten Hinweis zum Escaping unter Windows._
|
||||||
|
|
||||||
|
#### Vorbereitung
|
||||||
|
1. Besuchen Sie die Seite: https://crudcrud.com
|
||||||
|
2. Ihnen wird ein eindeutiger API-Endpunkt zugewiesen: Notieren Sie sich diesen. (Beispiel: https://crudcrud.com/api/bd8ba488cd2641618af6d0d016678159)
|
||||||
|
3. Öffnen Sie einen Terminal und setzen eine Variable `API_ID` mit Ihrer API-Kennung. (Beispiel: `API_ID=bd8ba488cd2641618af6d0d016678159`)
|
||||||
|
|
||||||
|
_Hinweis: Ihr persönlicher API-Endpunkt ist nur für 24 Stunden gültig und kann nur begrenzt viele Anfragen (100) entgegennehmen._
|
||||||
|
|
||||||
|
#### Arbeitsschritte
|
||||||
|
|
||||||
|
1. Führen Sie einfache POST-Requests aus (Achtung: Funktioniert nur mit gesetzter Variable oder setzen Sie Ihre eigene Endpunkt-Kennung manuell ein.)
|
||||||
|
|
||||||
|
1. Lavendel
|
||||||
|
```bash
|
||||||
|
curl -X POST https://crudcrud.com/api/${API_ID}/staudenpflanzen \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Lavendel", "botanischer_name": "Lavandula angustifolia", "standort": "Sonnig, trocken", "besonderheiten": "Duftend, bienenfreundlich, winterhart"}'
|
||||||
|
```
|
||||||
|
2. Pfingstrose
|
||||||
|
```bash
|
||||||
|
curl -X POST https://crudcrud.com/api/${API_ID}/staudenpflanzen \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Pfingstrose", "botanischer_name": "Paeonia lactiflora", "standort": "Halbschatten bis sonnig", "besonderheiten": "Große Blüten, langlebig, schnittgeeignet"}'
|
||||||
|
```
|
||||||
|
3. Funkie
|
||||||
|
```bash
|
||||||
|
curl -X POST https://crudcrud.com/api/${API_ID}/staudenpflanzen \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Funkie", "botanischer_name": "Hosta", "standort": "Halbschatten bis Schatten", "besonderheiten": "Dekoratives Laub, schneckenanfällig, pflegeleicht"}'
|
||||||
|
```
|
||||||
|
4. Formulieren Sie einen eigenen POST-Request für:<br>
|
||||||
|
_Name: Sonnenhut<br>
|
||||||
|
Botanischer Name: Echinacea purpurea<br>
|
||||||
|
Standort: Sonnig<br>
|
||||||
|
Besonderheiten: Heilpflanze, zieht Schmetterlinge an, robust<br>_
|
||||||
|
|
||||||
|
5. Formulieren Sie einen eigenen POST-Request für:<br>
|
||||||
|
_Name: Tränendes Herz<br>
|
||||||
|
Botanischer Name: Lamprocapnos spectabilis<br>
|
||||||
|
Standort: Halbschatten<br>
|
||||||
|
Besonderheiten: Herzförmige Blüten, romantisch, giftig<br>_
|
||||||
|
2. Überprüfen Sie das Ergebnis Ihrer POST-Requests:
|
||||||
|
|
||||||
|
1.
|
||||||
|
```bash
|
||||||
|
curl https://crudcrud.com/api/${API_ID}/staudenpflanzen
|
||||||
|
```
|
||||||
|
2. Finden Sie die IDs der Funkie, des Sonnenhuts und der Pfingstrose heraus und notieren Sie sich diese.
|
||||||
|
|
||||||
|
3. Führen Sie einfache PUT-Requests aus, indem Sie die richtige ID einsetzen `<id>`:
|
||||||
|
1. Sonnenhut
|
||||||
|
```bash
|
||||||
|
curl -X PUT https://crudcrud.com/api/${API_ID}/staudenpflanzen/<id> \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"name": "Sonnenhut", "botanischer_name": "Echinacea purpurea", "standort": "Sonnig", "besonderheiten": "Heilpflanze, zieht Schmetterlinge, schneckenanfällig"}'
|
||||||
|
```
|
||||||
|
2. Formulieren Sie einen eigenen PUT-Request für die Funkie und ändern Sie die Besonderheiten zu "Dekoratives Laub, schneckenanfällig, robust".
|
||||||
|
|
||||||
|
4. Führen Sie einen einfachen DELETE-Request aus
|
||||||
|
1. Pfingstrose
|
||||||
|
```bash
|
||||||
|
curl -X DELETE https://crudcrud.com/api/${API_ID}/staudenpflanzen/<id>
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Geben Sie die gesamte Liste der Staudenpflanzen aus
|
||||||
|
1.
|
||||||
|
```bash
|
||||||
|
curl https://crudcrud.com/api/${API_ID}/staudenpflanzen | jq
|
||||||
|
```
|
||||||
|
Speichern sie das zurückgelieferte JSON und geben Sie es als Lösung der Übung ab.
|
||||||
|
|
||||||
|
_Tipp: `jq` ist ein Kommandozeilen-Tool zur Formatierung von JSON-Daten. In diesem Beispiel filtert `jq` die Antwort von `curl`, sodass die JSON-Daten strukturiert und lesbar angezeigt werden._
|
||||||
|
|
||||||
|
## 4. JSON-Übung
|
||||||
|
|
||||||
|
**Aufgabenstellung**:
|
||||||
|
Erstellen Sie erste JSON-Objekte.
|
||||||
|
|
||||||
|
*Hinweis: Es ist nicht technisch vorgeschrieben, aber **Best Practice**, Schlüssel in Kleinbuchstaben zu halten (`camelCase`oder `snake_case` möglich, aber nicht mischen).*
|
||||||
|
|
||||||
|
#### Arbeitsschritte
|
||||||
|
|
||||||
|
1. Erstelle ein JSON-Objekt mit Informationen über eine Person:
|
||||||
|
1. Name: Alex
|
||||||
|
2. Alter: 30
|
||||||
|
3. Wohnort: Berlin
|
||||||
|
|
||||||
|
2. Erstelle ein JSON-Objekt zu einem Produkt:
|
||||||
|
1. Produktname: Kopfhörer
|
||||||
|
2. Preis: 89.99
|
||||||
|
3. Verfügbarkeit: Ja
|
||||||
|
4. Farben: Schwarz und Weiß (als Liste)
|
||||||
|
|
||||||
|
3. Erstelle ein JSON-Objekt zu einem Benutzer inklusive Adresse:
|
||||||
|
1. Benutzername: maria1999
|
||||||
|
2. Passwort: abc123
|
||||||
|
3. Rolle: Admin
|
||||||
|
4. Adresse: Bauernring 15 (Straße), Weilbach (Stadt) und 12345 (Postleitzahl) (*als verschachteltes Objekt*)
|
||||||
|
|
||||||
|
4. Erstelle ein Array mit zwei Aufgabenobjekten. Jede Aufgabe hat einen Titel und einen erledigt-Status (true/false)
|
||||||
|
|
||||||
|
5. Erstelle ein JSON-Objekt für einen Blogeintrag mit folgendem Aufbau:
|
||||||
|
1. Titel, Autor, Inhalt des Beitrags
|
||||||
|
2. Ein Kommentar als verschachteltes Objekt mit Autor und Text
|
||||||
|
|
||||||
|
## 5. SWAGGER-Übung
|
||||||
|
|
||||||
|
**Aufgabenstellung**:
|
||||||
|
Erweitern Sie eine bestehende API um Parameter (`GET`) und Request-Body (`POST`).
|
||||||
|
|
||||||
|
#### Arbeitsschritte
|
||||||
|
|
||||||
|
1. Öffnen Sie die "Simple Greeting API" (`05_loesungen/greeting.json`) in VS Code und starten Sie die _OpenAPI Preview_ (`Shift+Alt+P`).
|
||||||
|
|
||||||
|
2. Erweitern Sie die `GET`-Anfrage um einen Parameter `name` vom Typ `string`.
|
||||||
|
|
||||||
|
3. Erweitern Sie die `POST`-Anfrage um einen Request-Body vom Typ `string`.
|
||||||
|
|
||||||
|
4. Erweitern die API um einen weiteren `POST`-Endpunkt `/hello-json`, welcher ein JSON-Objekt im Request-Body erwartet. Folgendes Beispiel-JSON soll möglich sein:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "Florian",
|
||||||
|
"age": 23
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "Simple Greeting API",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/hello": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Returns a greeting",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Greeting response in plain text.",
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Hello!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"summary": "Returns a plain text greeting",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Plain text greeting response",
|
||||||
|
"content": {
|
||||||
|
"text/plain": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "Hello!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
## Escaping
|
||||||
|
|
||||||
|
Unter **Windows**, insbesondere in **PowerShell** oder der **Eingabeaufforderung (cmd.exe)**, unterscheidet sich das Escaping von `curl`-Anfragen deutlich von Linux oder macOS. Hier sind die wichtigsten Hinweise:
|
||||||
|
|
||||||
|
### Escaping in PowerShell
|
||||||
|
|
||||||
|
1. Verwenden Sie **doppelte Anführungszeichen (`"`)** außen und **backticks (`\"`)** zum Escapen von inneren doppelten Anführungszeichen.
|
||||||
|
|
||||||
|
#### Beispiel:
|
||||||
|
```powershell
|
||||||
|
curl -X POST "https://crudcrud.com/api/$API_ID/staudenpflanzen" `
|
||||||
|
-H "Content-Type: application/json" `
|
||||||
|
-d "{`"name`":`"Lavendel`",`"botanischer_name`":`"Lavandula angustifolia`",`"standort`":`"Sonnig`"}"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Alternativ können Sie einfach **doppelte doppelte Anführungszeichen (`""`)** innerhalb eines Strings verwenden.
|
||||||
|
|
||||||
|
#### Beispiel:
|
||||||
|
```powershell
|
||||||
|
curl -X POST "https://crudcrud.com/api/$API_ID/staudenpflanzen" `
|
||||||
|
-H "Content-Type: application/json" `
|
||||||
|
-d "{""name"":""Lavendel"",""botanischer_name"":""Lavandula angustifolia"",""standort"":""Sonnig""}"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Escaping in Eingabeaufforderung (cmd.exe)
|
||||||
|
|
||||||
|
- Verwenden Sie **doppelte Anführungszeichen** außen, aber **kein Backtick**.
|
||||||
|
- JSON-Inhalt muss alle inneren Anführungszeichen mit einem Backslash escapen (`\"` statt `"`)
|
||||||
|
|
||||||
|
#### Beispiel:
|
||||||
|
```cmd
|
||||||
|
curl -X POST "https://crudcrud.com/api/%API_ID%/staudenpflanzen" ^
|
||||||
|
-H "Content-Type: application/json" ^
|
||||||
|
-d "{\"name\":\"Lavendel\",\"botanischer_name\":\"Lavandula angustifolia\",\"standort\":\"Sonnig\"}"
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue