'Postman login endpoint definition api OpenApi 3.0
I have just started using postman so that I can serve my front end. I have managed to create a mock service and define some schema and some endpoints. I have also added the bearer authorization. I do not understand how to implement the login endpoint to get back the auth token.
I understand it must be a POST, with no security check, sending email and psw
What other values should I consider?
openapi: 3.0.0
info:
version: 'draft'
title: 'MY API'
license:
name: MIT
servers:
- url: 'https://e9d52583-3413-476e-b0a9-02c4151be665.mock.pstmn.io'
paths:
/user:
get:
summary: 'User: Returns details about a particular user'
operationId: listUser
tags:
- user
parameters:
- name: id
in: query
description: ID of the user
required: true
schema:
type: integer
format: int32
responses:
'200':
description: 'User: Details about a user by ID'
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/User'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/brands:
get:
summary: 'Brands: List all brands'
operationId: listBrands
tags:
- brands
responses:
200:
description: 'Brands: An array of brands'
headers:
x-next:
description: 'Brands: A link to the next page of responses'
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Brands"
401:
description: 'Not authorized'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/brand:
get:
summary: 'Brand: Returns details about a particular brand'
operationId: listBrand
tags:
- brand
parameters:
- name: id
in: query
description: ID of the user
required: true
schema:
type: integer
format: int32
responses:
'200':
description: 'Brand: Details about a brand by ID'
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
User:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Brand:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Brands:
type: array
items:
$ref: "#/components/schemas/Brand"
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
securitySchemes:
bearerAuth:
type: http
scheme: 'bearer'
bearerFormat: 'JWT'
responses:
UnauthorizedError:
description: Access token is missing or invalid
security:
- bearerAuth: []
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
