slogan3

Ontwerp een gedetailleerde OpenAPI-specificatie voor mijn API

description

Met deze prompt kan ik snel een correcte en overzichtelijke OpenAPI-specificatie maken die ontwikkelaars helpt mijn API te begrijpen en integreren. Dit voorkomt fouten, bespaart tijd en verbetert de samenwerking en kwaliteit van mijn API-documentatie.

prompt

Help me een gedetailleerde OpenAPI-specificatie te creëren die mijn API nauwkeurig beschrijft met de volgende kenmerken: API Naam: <voer de naam van mijn API in> Korte omschrijving: <beschrijf kort het doel en de functionaliteiten van mijn API> Belangrijkste endpoints en HTTP-methoden: <beschrijf de belangrijkst ...

try_prompt

generate_helper
disclaimerOnPageApi

ai_answers

provider: openai
model: gpt-4.1-nano
openapi: 3.0.3 info: title: Productenbeheer API description: API voor het beheren van producten en bestellingen version: 1.0.0 servers: - url: https://api.example.com description: Hoofdserver components: securitySchemes: ApiKeyAuth: type: apiKey in: header name: X-API-KEY schemas: Product: type: object properties: id: type: string description: Unieke identifier van het product example: "prod-12345" naam: type: string description: Naam van het product example: "Laptop" prijs: type: number format: float description: Prijs van het product example: 999.99 voorraad: type: integer description: Aantal beschikbare eenheden example: 50 Bestelling: type: object properties: id: type: string description: Unieke identifier van de bestelling example: "best-67890" producten: type: array items: $ref: '#/components/schemas/Product' totaalPrijs: type: number format: float description: Totale prijs van de bestelling example: 1999.98 status: type: string description: Status van de bestelling example: "In behandeling" security: - ApiKeyAuth: [] paths: /producten: get: summary: "Lijst van alle producten" description: Haalt een lijst van alle beschikbare producten op. security: - ApiKeyAuth: [] responses: '200': description: Success, lijst van producten content: application/json: schema: type: array items: $ref: '#/components/schemas/Product' examples: example1: value: - id: "prod-12345" naam: "Laptop" prijs: 999.99 voorraad: 50 - id: "prod-67890" naam: "Monitor" prijs: 199.99 voorraad: 30 post: summary: "Nieuw product toevoegen" description: Voegt een nieuw product toe aan de catalogus. security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Product' examples: example1: value: id: "prod-11111" naam: "Toetsenbord" prijs: 49.99 voorraad: 100 responses: '201': description: Product succesvol toegevoegd content: application/json: schema: $ref: '#/components/schemas/Product' examples: example1: value: id: "prod-11111" naam: "Toetsenbord" prijs: 49.99 voorraad: 100 /bestellingen: get: summary: "Lijst van alle bestellingen" description: Haalt een lijst van alle bestellingen op. security: - ApiKeyAuth: [] responses: '200': description: Success, lijst van bestellingen content: application/json: schema: type: array items: $ref: '#/components/schemas/Bestelling' examples: example1: value: - id: "best-67890" producten: - id: "prod-12345" naam: "Laptop" prijs: 999.99 voorraad: 50 - id: "prod-67890" naam: "Monitor" prijs: 199.99 voorraad: 30 totaalPrijs: 1199.98 status: "In behandeling" post: summary: "Nieuwe bestelling plaatsen" description: Plaatst een nieuwe bestelling. security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: type: object properties: producten: type: array items: $ref: '#/components/schemas/Product' status: type: string description: Status van de bestelling example: "In behandeling" examples: example1: value: producten: - id: "prod-12345" naam: "Laptop" prijs: 999.99 voorraad: 50 - id: "prod-67890" naam: "Monitor" prijs: 199.99 voorraad: 30 status: "In behandeling" responses: '201': description: Bestelling succesvol geplaatst content: application/json: schema: $ref: '#/components/schemas/Bestelling' examples: example1: value: id: "best-67891" producten: - id: "prod-12345" naam: "Laptop" prijs: 999.99 voorraad: 50 - id: "prod-67890" naam: "Monitor" prijs: 199.99 voorraad: 30 totaalPrijs: 1199.98 status: "In behandeling"
provider: deepseek
model: deepseek-chat
Zeker, hier is een gedetailleerde OpenAPI 3.0.1-specificatie in YAML voor je Productenbeheer API: ```yaml openapi: 3.0.1 info: title: Productenbeheer API description: API voor het beheren van producten en bestellingen version: 1.0.0 contact: name: API Ondersteuning email: support@voorbeeld.nl servers: - url: https://api.voorbeeld.nl/v1 description: Productie server - url: https://sandbox-api.voorbeeld.nl/v1 description: Test server components: securitySchemes: ApiKeyAuth: type: apiKey in: header name: X-API-Key description: Jouw persoonlijke API-sleutel voor authenticatie schemas: Product: type: object required: - naam - prijs - voorraad properties: id: type: integer format: int64 example: 12345 description: Unieke identifier van het product naam: type: string example: "Stoel" description: Naam van het product beschrijving: type: string example: "Een comfortabele bureaustoel" description: Gedetailleerde beschrijving van het product prijs: type: number format: float example: 199.99 description: Prijs van het product in EUR voorraad: type: integer example: 50 description: Aantal beschikbare stuks categorie: type: string example: "meubilair" description: Categorie van het product Bestelling: type: object required: - product_id - hoeveelheid - klant_gegevens properties: id: type: integer format: int64 example: 1001 description: Unieke identifier van de bestelling product_id: type: integer format: int64 example: 12345 description: ID van het bestelde product hoeveelheid: type: integer example: 2 description: Aantal bestelde stuks totaalprijs: type: number format: float example: 399.98 description: Totale prijs van de bestelling status: type: string enum: [verwerkt, in_behandeling, verzonden, afgeleverd] example: "in_behandeling" description: Huidige status van de bestelling klant_gegevens: type: object properties: naam: type: string example: "Jan Jansen" email: type: string format: email example: "jan@voorbeeld.nl" adres: type: string example: "Voorbeeldstraat 123, 1234 AB Amsterdam" besteld_op: type: string format: date-time example: "2024-01-15T10:30:00Z" description: Tijdstip van plaatsen bestelling Foutbericht: type: object properties: error: type: string example: "Ongeldige API-sleutel" code: type: integer example: 401 details: type: string example: "De opgegeven API-sleutel is niet geldig" security: - ApiKeyAuth: [] paths: /producten: get: summary: Haal alle producten op description: Retourneert een lijst met alle beschikbare producten tags: - Producten responses: '200': description: Succesvolle ophalen van producten content: application/json: schema: type: array items: $ref: '#/components/schemas/Product' example: - id: 12345 naam: "Stoel" beschrijving: "Een comfortabele bureaustoel" prijs: 199.99 voorraad: 50 categorie: "meubilair" - id: 12346 naam: "Tafel" beschrijving: "Stevige eikenhouten tafel" prijs: 299.99 voorraad: 25 categorie: "meubilair" '401': description: Niet geautoriseerd content: application/json: schema: $ref: '#/components/schemas/Foutbericht' '500': description: Interne serverfout post: summary: Maak een nieuw product aan description: Voeg een nieuw product toe aan de catalogus tags: - Producten requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Product' example: naam: "Lamp" beschrijving: "Moderne LED-lamp" prijs: 89.99 voorraad: 100 categorie: "verlichting" responses: '201': description: Product succesvol aangemaakt content: application/json: schema: $ref: '#/components/schemas/Product' example: id: 12347 naam: "Lamp" beschrijving: "Moderne LED-lamp" prijs: 89.99 voorraad: 100 categorie: "verlichting" '400': description: Ongeldige aanvraag content: application/json: schema: $ref: '#/components/schemas/Foutbericht' '401': description: Niet geautoriseerd '500': description: Interne serverfout /bestellingen: get: summary: Haal alle bestellingen op description: Retourneert een lijst met alle bestellingen tags: - Bestellingen responses: '200': description: Succesvolle ophalen van bestellingen content: application/json: schema: type: array items: $ref: '#/components/schemas/Bestelling' example: - id: 1001 product_id: 12345 hoeveelheid: 2 totaalprijs: 399.98 status: "verwerkt" klant_gegevens: naam: "Jan Jansen" email: "jan@voorbeeld.nl" adres: "Voorbeeldstraat 123, Amsterdam" besteld_op: "2024-01-15T10:30:00Z" '401': description: Niet geautoriseerd content: application/json: schema: $ref: '#/components/schemas/Foutbericht' '500': description: Interne serverfout post: summary: Plaats een nieuwe bestelling description: Maak een nieuwe bestelling aan tags: - Bestellingen requestBody: required: true content: application/json: schema: type: object required: - product_id - hoeveelheid - klant_gegevens properties: product_id: type: integer format: int64 hoeveelheid: type: integer klant_gegevens: type: object required: - naam - email - adres properties: naam: type: string email: type: string format: email adres: type: string example: product_id: 12345 hoeveelheid: 1 klant_gegevens: naam: "Piet Pietersen" email: "piet@voorbeeld.nl" adres: "Teststraat 456, Rotterdam" responses: '201': description: Bestelling succesvol geplaatst content: application/json: schema: $ref: '#/components/schemas/Bestelling' example: id: 1002 product_id: 12345 hoeveelheid: 1 totaalprijs: 199.99 status: "in_behandeling" klant_gegevens: naam: "Piet Pietersen" email: "piet@voorbeeld.nl" adres: "Teststraat 456, Rotterdam" besteld_op: "2024-01-15T14:22:00Z" '400': description: Ongeldige aanvraag content: application/json: schema: $ref: '#/components/schemas/Foutbericht' '401': description: Niet geautoriseerd '404': description: Product niet gevonden '500': description: Interne serverfout ``` Deze specificatie bevat: - API-sleutel authenticatie via header - Volledige JSON schema's voor requests en responses - Gedetailleerde voorbeelden voor alle endpoints - Foutafhandeling met duidelijke statuscodes - Tags voor betere organisatie - Meerdere serverconfiguraties Je kunt deze YAML direct gebruiken met tools zoals Swagger UI, Redoc, of voor automatische validatie en client-generatie.