-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
158 lines (157 loc) · 3.91 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
## Reference => https://github.com/DinmaOtutu/RIDE-MY-WAY/
swagger: "2.0"
info:
description: "This is a diary application that allows users to create, modify and view their diary entries."
version: "1.0.0"
title: "MY DIARY"
contact:
email: "[email protected]"
host: "my-diary-challenge.herokuapp.com"
basePath: "/"
schemes:
- "https"
- "http"
paths:
api/v1/entries:
get:
tags:
- "Entries"
summary: "Get all entries"
description: "Returns a json of all entries of a particular user"
produces:
- "application/json"
responses:
200:
description: "Success"
401:
description: "No token provided"
500:
description: "Server Error or Invalid token"
api/v1/entries/:entryId:
get:
tags:
- "Entries"
summary: "Get a single entry"
description: "Returns an object containing details of a particular entry"
produces:
- "application/json"
parameters:
- in: "body"
name: "entryId"
description: "the required ID to be returned"
required: true
responses:
200:
description: "Entry Details"
404:
description: "entry not found"
401:
description: "Token not provided"
500:
description: "Server Error or Invalid token"
api/v1/entries/:
post:
tags:
- "Entries"
summary: "Create an entry"
description: "Creates a diary entry"
produces:
- "application/json"
responses:
200:
description: "successfully created"
400:
description: "Incomplete values or bad request"
401:
description: "No token Provided"
500:
description: "Server Error or Invalid token"
api/v1/entries/:entryId/:
put:
tags:
- "Entries"
summary: "Modify an entry"
description: "Modifies a diary entry"
produces:
- "application/json"
responses:
200:
description: "successful"
400:
description: "Incomplete values or bad request"
401:
description: "No token provided"
500:
description: "Server Error or Invalid token"
api/v1/auth/signup:
post:
tags:
- "User"
summary: "Creates a new user"
description: "A new user is created and a token is given to be able to access protected routes(endpoints)"
produces:
- "application/json"
responses:
201:
description: "successfully created"
500:
description: "server Error"
schema:
$ref: "#/definitions/User"
api/v1/auth/login:
post:
tags:
- "User"
summary: "Logs in an existing user"
description: "The logged in user gets a token to be able to access protected routes "
produces:
- "application/json"
parameters:
- name: "email"
in: "query"
description: "The email for login"
required: true
type: "string"
- name: "password"
in: "query"
description: "The password for login"
required: true
type: "string"
responses:
200:
description: "successfully logged in"
schema:
type: "string"
401:
description: "Invalid email or password"
schema:
$ref: "#/definitions/User"
securityDefinitions:
api_key:
name: "token"
in: "header"
definitions:
createEntry:
type: "object"
properties:
id:
type: "integer"
title:
type: "string"
category:
type: "string"
subCategory:
type: "string"
content:
type: "string"
User:
type: "object"
properties:
id:
type: "integer"
name:
type: "string"
email:
type: "string"
password:
type: "string"