-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
278 lines (275 loc) · 8.82 KB
/
openapi.yaml
File metadata and controls
278 lines (275 loc) · 8.82 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
openapi: 3.0.0
info:
version: 1.0.0
title: A Scraper
description: |
This defines how a scraper should behave.
## Auth
The basic auth authentication username and password can be obtained via RT-CV.
Within RT-CV select the scraper you want the credentials of and copy the `Key ID` and the `Key` itself.
Now you can use the `Key ID` as username and `Key` as password
Most server side HTTP clients allow basic auth credentials within the url so making requests to a scraper is as easy as:
```sh
# Make sure to replace the username and password with RT-CV scraper's key key id and key
curl https://aaaaaaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@werk-scraper.fly.dev/health
```
servers:
- url: https://werk-scraper.fly.dev
- url: https://ikbenbeschikbaar-scraper.fly.dev
- url: https://debanensite-scraper.fly.dev
- url: https://techniekwerkt-scraper.fly.dev
- url: https://f2f-linkedin-scraper.fly.dev
security:
- basicAuth: []
paths:
/health:
get:
description: Used by other services to check if a scraper is alive
responses:
200:
description: The scraper is functioning as expected.
content:
application/json:
schema:
type: object
required:
- status
- lastSentCv
properties:
status:
type: boolean
const: true
lastSentCv:
description: iso timestamp with time of last send cv if it has been send
type: string
format: date-time
nullable: true
500:
description: The scraper is malfunctioning, see the returned errors for more information
content:
application/json:
schema:
type: object
required:
- status
- lastSentCv
- errors
properties:
status:
type: boolean
const: false
lastSentCv:
description: iso timestamp with time of last send cv if it has been send
type: string
format: date-time
nullable: true
errors:
description: List of errors if status is false.
type: array
items:
type: string
401:
$ref: "#/components/responses/UnauthorizedError"
/cv:
post:
description: Get a single CV by its reference number
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- referenceNr
properties:
referenceNr:
type: string
minLength: 1
responses:
200:
description: The CV
content:
application/json:
schema:
type: object
required:
- cv
properties:
cv:
description: Contains the cv in the, the format of the cv is described by the RT-CV server https://bitbucket.org/teamscript/rt-cv/src/main/models/cv.go#lines-18
type: object
hasDocument:
description: Indicates if this cv has a cv document attached and the cv mata mostly likely is minimal
type: boolean
400:
$ref: "#/components/responses/BadRequest"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotImplemented"
500:
$ref: "#/components/responses/InternalServerError"
/cv-document:
post:
description: Get a CV Document by its reference number,
you can check if a cv has a document by using the /cv endpoint
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- referenceNr
properties:
referenceNr:
type: string
minLength: 1
responses:
200:
description: The CV document
headers:
Content-Type:
description: The document mimetype of the cv document
schema:
type: string
Filename:
description: The filename of the cv document
schema:
type: string
400:
$ref: "#/components/responses/BadRequest"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotImplemented"
500:
$ref: "#/components/responses/InternalServerError"
/check-credentials:
post:
description: Check if given credentials are correct
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- username
- password
properties:
username:
type: string
minLength: 1
password:
type: string
minLength: 1
responses:
200:
description: The given credentials where checked correctly
content:
application/json:
schema:
type: object
required:
- valid
properties:
valid:
type: boolean
400:
$ref: "#/components/responses/BadRequest"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotImplemented"
500:
$ref: "#/components/responses/InternalServerError"
/check-site-storage-credentials:
post:
description: Check if given credentials are correct
requestBody:
required: true
content:
application/json:
schema:
description: The credentials to check.
type: object
properties:
cookies:
description: if the site uses cookies for authentication. The key is the cookie name and the value is the cookie value
type: object
additionalProperties:
type: array
items:
type: string
responses:
200:
description: The given credentials where checked correctly
content:
application/json:
schema:
type: object
required:
- valid
properties:
valid:
type: boolean
400:
$ref: "#/components/responses/BadRequest"
401:
$ref: "#/components/responses/UnauthorizedError"
404:
$ref: "#/components/responses/NotImplemented"
500:
$ref: "#/components/responses/InternalServerError"
components:
securitySchemes:
basicAuth:
description: Authenticate using the same credentials as the credentials in RTCV_SERVER
type: http
scheme: basic
schemas:
Error:
type: object
required:
- error
properties:
error:
type: string
responses:
UnauthorizedError:
description: Basic authentication missing or invalid
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
NotImplemented:
description: Not implemented
headers:
X-Not-Implemented:
schema:
type: boolean
default: true
description: "A header that indicates that this method is not implemented"
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: string
default: "Not Implemented"
InternalServerError:
description: Internal server error, something within the scraper went wrong that is un related to the provided login credentials thus the given login credentials might be valid or invalid this is just a server failure.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
BadRequest:
description: Bad request, this is most likely returned when the body is invalid
content:
application/json:
schema:
$ref: "#/components/schemas/Error"