Maak een OpenAPI-specificatie voor de integratie van mijn API met derden
description
Door deze prompt te gebruiken, kunt u ervoor zorgen dat de integratiemogelijkheden van uw API goed gedocumenteerd zijn, waardoor het voor ontwikkelaars gemakkelijker wordt om te begrijpen hoe ze met uw API kunnen werken en deze kunnen integreren met andere diensten.
prompt
try_prompt
Help me een OpenAPI-specificatie ontwikkelen die beschrijft hoe mijn API integreert met verschillende derden. Gelieve details op te nemen zoals: API Naam: {{api_naam}}, Derde Pa ... more
generate_helper
...
tags
ai_answers
provider: openai
model: gpt-4.1-nano
Natuurlijk! Hier is een voorbeeld van een OpenAPI-specificatie voor jouw WeerAPI die de integratie met derden beschrijft, inclusief de gevraagde details:
```yaml
openapi: 3.0.3
info:
title: WeerAPI
version: 1.0.0
description: >
API voor het verkrijgen van weersinformatie. Deze API integreert met derden zoals Stripe voor betalingsverwerking.
De communicatie verloopt via REST en authenticatie gebeurt via OAuth2.
servers:
- url: https://api.weerapi.nl/v1
components:
securitySchemes:
OAuth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://auth.weerapi.nl/oauth/authorize
tokenUrl: https://auth.weerapi.nl/oauth/token
scopes:
read: Weergegevens lezen
write: Gegevens schrijven
security:
- OAuth2: [read, write]
paths:
/weer:
get:
summary: Haal weersinformatie op
description: >
Deze endpoint geeft actuele weersgegevens terug.
security:
- OAuth2: [read]
responses:
'200':
description: Succesvolle weersgegevens
content:
application/json:
schema:
type: object
properties:
locatie:
type: string
example: Amsterdam
temperatuur:
type: number
format: float
example: 21.5
conditie:
type: string
example: Zonnig
/betalingen:
post:
summary: Verwerk betaling via Stripe
description: >
Deze endpoint verwerkt betalingen via Stripe.
security:
- OAuth2: [write]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
bedrag:
type: number
format: float
example: 49.99
currency:
type: string
example: EUR
description:
type: string
example: "WeerAPI abonnement"
stripeToken:
type: string
description: Token verkregen van Stripe SDK
responses:
'200':
description: Betaling succesvol
content:
application/json:
schema:
type: object
properties:
betalingId:
type: string
example: "pay_1Hh1XYZ..."
status:
type: string
example: Succesvol
# Voorbeeldgebruikscenario's
x-examples:
- naam: WeerAPI
beschrijving: >
Gebruiker authenticatie via OAuth2, haalt actuele weersgegevens op en verwerkt betalingen via Stripe.
stappen:
- Stap 1: OAuth2 authenticatie verkrijgen
- Stap 2: Aanroepen /weer endpoint om weersinformatie te krijgen
- Stap 3: Betaling verwerken via /betalingen endpoint met Stripe token
```
Indien je verder wilt uitbreiden of meer details nodig hebt, laat het gerust weten!
provider: deepseek
model: deepseek-chat
Zeker, hier is een OpenAPI-specificatie (3.0.0) voor je WeerAPI die integreert met Stripe:
```yaml
openapi: 3.0.0
info:
title: WeerAPI Integratie Service
description: API voor het integreren van WeerAPI met externe diensten zoals Stripe
version: 1.0.0
contact:
name: API Support
email: support@weerapi.example.com
servers:
- url: https://api.weerapi.example.com/v1
description: Productieserver
paths:
/integrations/stripe/payment:
post:
summary: Verwerk betaling via Stripe
description: Integreer met Stripe voor betalingsverwerking
tags:
- Stripe Integratie
security:
- OAuth2: [payments.write]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/StripePaymentRequest'
example:
amount: 1999
currency: "eur"
description: "Weerdata abonnement"
customer_email: "klant@example.com"
responses:
'200':
description: Betaling succesvol verwerkt
content:
application/json:
schema:
$ref: '#/components/schemas/StripePaymentResponse'
example:
payment_id: "pi_3ABC123Def456GhI789JklM"
status: "succeeded"
amount: 1999
currency: "eur"
'400':
description: Ongeldig verzoek
'401':
description: Niet geautoriseerd
'500':
description: Interne serverfout
/weather/data:
get:
summary: Haal weerdata op
description: Haal actuele weerinformatie op via WeerAPI
tags:
- WeerAPI
security:
- OAuth2: [weather.read]
parameters:
- name: location
in: query
required: true
schema:
type: string
description: Locatie voor weerdata (bijv. "Amsterdam,NL")
- name: units
in: query
schema:
type: string
enum: [metric, imperial]
default: metric
description: Eenheidssysteem voor metingen
responses:
'200':
description: Weerdata succesvol opgehaald
content:
application/json:
schema:
$ref: '#/components/schemas/WeatherData'
example:
location: "Amsterdam,NL"
temperature: 15.5
humidity: 65
conditions: "licht bewolkt"
wind_speed: 12.3
'401':
description: Niet geautoriseerd
'404':
description: Locatie niet gevonden
components:
schemas:
StripePaymentRequest:
type: object
required:
- amount
- currency
- customer_email
properties:
amount:
type: integer
description: Bedrag in centen
minimum: 50
currency:
type: string
enum: [eur, usd, gbp]
description: Valuta
description:
type: string
description: Beschrijving van de betaling
customer_email:
type: string
format: email
description: E-mailadres van de klant
StripePaymentResponse:
type: object
properties:
payment_id:
type: string
description: Stripe betalings-ID
status:
type: string
enum: [succeeded, pending, failed]
amount:
type: integer
currency:
type: string
WeatherData:
type: object
properties:
location:
type: string
temperature:
type: number
format: float
humidity:
type: integer
minimum: 0
maximum: 100
conditions:
type: string
wind_speed:
type: number
format: float
securitySchemes:
OAuth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://auth.weerapi.example.com/oauth/authorize
tokenUrl: https://auth.weerapi.example.com/oauth/token
scopes:
weather.read: Weerdata lezen
payments.write: Betalingen verwerken
responses:
UnauthorizedError:
description: Toegangstoken ontbreekt of is ongeldig
NotFoundError:
description: Gevraagde resource niet gevonden
```
**Integratiemethoden Details:**
- **REST API**: Alle endpoints gebruiken RESTful principes
- **JSON**: Data uitwisseling in JSON-formaat
- **HTTP Status Codes**: Duidelijke statuscodes voor verschillende scenario's
**Authenticatievereisten:**
- OAuth 2.0 Authorization Code flow
- Vereiste scopes per endpoint
- JWT Bearer tokens
**Voorbeeldgebruikscenario's WeerAPI:**
1. **Betalingsintegratie Scenario:**
```bash
# 1. Autoriseer via OAuth2
# 2. Verwerk betaling voor weerdata abonnement
POST /integrations/stripe/payment
Authorization: Bearer <oauth_token>
{
"amount": 1999,
"currency": "eur",
"description": "Premium weerdata maandabonnement",
"customer_email": "gebruiker@example.com"
}
```
2. **Weerdata Opvragen Scenario:**
```bash
# 1. Autoriseer via OAuth2
# 2. Haal weerdata op
GET /weather/data?location=Amsterdam,NL&units=metric
Authorization: Bearer <oauth_token>
```
3. **Compleet Integratie Scenario:**
- Gebruiker autoriseert via OAuth2
- Verwerkt betaling via Stripe integratie
- Ontvangt weerdata na succesvolle betaling
- Herhaalt proces voor toekomstige aanvragen
Deze specificatie biedt een solide basis voor je API-integraties en kan worden uitgebreid met aanvullende derde partijen en functionaliteiten.

