-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
353 lines (353 loc) · 9.39 KB
/
openapi.yml
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
openapi: 3.0.0
info:
description: API for the Stanford digital repository technical metadata
version: 1.0.0
title: Technical Metadata API
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
servers:
- url: 'https://technical-metadata-{env}.stanford.edu'
description: Production service
variables:
env:
default: prod
- url: 'https://technical-metadata-{env}.stanford.edu'
description: Staging service
variables:
env:
default: stage
tags:
- name: metadata
description: Digital Repository Objects
paths:
/v1/technical-metadata:
post:
tags:
- metadata
summary: Create the metadata for the object
description: ''
operationId: 'technical_metadata#create'
responses:
'200':
description: OK
requestBody:
content:
application/json:
schema:
type: object
required:
- druid
- files
- basepath
properties:
druid:
$ref: '#/components/schemas/Druid'
files:
type: array
items:
$ref: '#/components/schemas/FileInfo'
basepath:
type: string
description: Path to be removed from filepath to get filename
force:
type: boolean
description: Extract the technical metadata even if a record already exists with that checksum
lane-id:
type: string
enum:
- 'default'
- 'low'
default: 'default'
/v1/technical-metadata/druid/{druid}:
get:
tags:
- metadata
summary: Get the metadata for the files associated with a druid
description: ''
operationId: technical_metadata#show_by_druid
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DroFile'
'404':
description: Druid not found
parameters:
- name: druid
in: path
description: druid for which to return the technical metadata
required: true
schema:
$ref: '#/components/schemas/Druid'
/v1/technical-metadata/audit/{druid}:
post:
tags:
- metadata
summary: Diff the technical metadata DB entries for a druid against the expected file/hash list provided to the endpoint
description: ''
operationId: technical_metadata#audit_by_druid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FileAuditResult'
'404':
description: Druid not found
'401':
description: Unauthorized
parameters:
- name: druid
in: path
description: druid for which to audit the technical metadata
required: true
schema:
$ref: '#/components/schemas/Druid'
requestBody:
content:
application/json:
schema:
type: object
required:
- expected_files
properties:
expected_files:
type: array
items:
$ref: '#/components/schemas/FileAuditInfo'
components:
schemas:
AudioMetadata:
description: Audio-specific technical metadata
type: object
properties:
format_profile:
type: string
codec_id:
type: string
channels:
type: string
sampling_rate:
type: integer
bit_depth:
type: integer
stream_size:
type: integer
AvMetadata:
description: Audio/visual-specific technical metadata
type: object
properties:
video_count:
type: integer
audio_count:
type: integer
other_count:
type: integer
file_extension:
type: string
format:
type: string
format_profile:
type: string
codec_id:
type: string
duration:
type: number
format: float
frame_rate:
type: number
format: float
encoded_date:
type: string
DroFile:
description: Technical metadata for a single file
type: object
properties:
druid:
$ref: '#/components/schemas/Druid'
filename:
type: string
filetype:
description: Pronom id
type: string
mimetype:
type: string
bytes:
type: integer
file_modification:
type: string
format: date-time
image_metadata:
$ref: '#/components/schemas/ImageMetadata'
pdf_metdata:
$ref: '#/components/schemas/PdfMetadata'
av_metadata:
$ref: '#/components/schemas/AvMetadata'
dro_file_parts:
type: array
items:
$ref: '#/components/schemas/DroFilePart'
required:
- druid
- filename
DroFilePart:
description: Technical metadata for part of a file, e.g., a track
type: object
properties:
part_type:
type: string
enum:
- 'audio'
- 'video'
- 'text'
- 'other'
part_id:
type: string
order:
type: integer
format:
type: string
audio_metadata:
$ref: '#/components/schemas/AudioMetadata'
video_metadata:
$ref: '#/components/schemas/VideoMetadata'
other_metadata:
$ref: '#/components/schemas/OtherAvMetadata'
required:
- part_type
Druid:
description: Digital Repository Unique Identifier (ID)
type: string
pattern: '^druid:[b-df-hjkmnp-tv-z]{2}[0-9]{3}[b-df-hjkmnp-tv-z]{2}[0-9]{4}$'
example: 'druid:bc123df4567'
FileURI:
description: File URI for the absolute path of the file
type: string
pattern: '^file:\/\/\/([^\\/]+\/)*[^\\/]+$'
example: 'file:///foo/bar/baz/quix.jp2'
FileName:
description: filename for a file in SDR (from Cocina metadata)
type: string
pattern: '^([^\\/]+\/)*[^\\/]+$'
example: 'foo/bar/baz/quix.jp2'
FileInfo:
description: Information about a file.
type: object
properties:
uri:
$ref: '#/components/schemas/FileURI'
md5:
type: string
required:
- uri
- md5
FileAuditInfo:
description: Information about a file in SDR for which we expect technical metadata to exist.
type: object
properties:
filename:
$ref: '#/components/schemas/FileName'
md5:
type: string
required:
- filename
- md5
FileAuditResult:
description: Information about detected differences between expected technical metadata entries and actual technical metadata entries
type: object
properties:
missing_filenames:
type: array
items:
$ref:
'#/components/schemas/FileName'
unexpected_filenames:
type: array
items:
$ref:
'#/components/schemas/FileName'
mismatched_checksum_file_infos:
type: array
items:
$ref:
'#/components/schemas/FileAuditInfo'
ImageMetadata:
description: Image-specific technical metadata
type: object
properties:
# Some image formats, e.g., SVG return floats for height and width, hence type: number
height:
type: number
width:
type: number
OtherAvMetadata:
description: Other technical metadata for a file part
type: object
properties:
other_type:
type: string
type:
type: string
PdfMetadata:
description: PDF-specific technical metadata
type: object
properties:
pdf_version:
type: string
pages:
type: integer
page_size:
type: string
tagged:
type: boolean
encrypted:
type: boolean
javascript:
type: boolean
form:
type: boolean
text:
type: boolean
creator:
type: string
producer:
type: string
VideoMetadata:
description: Video-specific technical metadata
type: object
properties:
format_profile:
type: string
codec_id:
type: string
height:
type: integer
width:
type: integer
display_aspect_ratio:
type: number
format: float
pixel_aspect_ratio:
type: number
format: float
frame_rate:
type: number
format: float
color_space:
type: string
chroma_subsampling:
type: string
bit_depth:
type: integer
language:
type: string
stream_size:
type: integer
standard:
type: string