Open API Flashcards

1
Q

What is?

A

OpenAPI (formerly known as Swagger) open-source standard for defining RESTful APIs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Structure

A

Metadata
Servers
Paths
Components
Security

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Metadata

A

Information about the API:
openapi: 3.0.3
info:
title: Sample API
description: API for demonstrating OpenAPI
version: 1.0.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Servers

A

Defines the API’s base URLs:
servers:
- url: https://api.example.com/v1
description: Production server
- url: https://staging-api.example.com/v1
description: Staging server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Paths

A

paths:
/users:
get:
summary: Retrieve a list of users
responses:
‘200’:
description: A JSON array of users
content:
application/json:
schema:
type: array
items:
$ref: ‘#/components/schemas/User’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Components

A

components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Security

A

security:
- apiKeyAuth: []
components:
securitySchemes:
apiKeyAuth:
type: apiKey
in: header
name: Authorization

security:
- apiKeyAuth: []
This indicates that all requests to the API require an API key sent in the Authorization header
the [] specifies the required scopes (permissions) that a client must have to access the endpoint.
Example security:
- oauth2Auth: [“read”, “write”]
apiKeyAuth: [] - indicates that only the apiKeyAuth scheme is required, with no additional conditions (like scopes). Even though apiKeyAuth and other schemes like http don’t use scopes, OpenAPI uses a consistent format for defining security requirements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly