-
Notifications
You must be signed in to change notification settings - Fork 0
/
quantum-compute-api_v1.yaml
403 lines (388 loc) · 12.8 KB
/
quantum-compute-api_v1.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
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
openapi: 3.0.3
info:
title: "Quantum Computing API - University of Vienna"
version: "1.0"
servers:
- url: "https://quco.exp.univie.ac.at/api/v1"
security:
- bearerAuth: []
paths:
/login:
post:
summary: Login with username and password
requestBody:
content:
application/json:
schema:
properties:
username:
type: string
example: test@test.at
password:
type: string
example: 12345
responses:
"200":
description: OK - Returns an authorization token to use in subsequent calls within the HTTP Authorization header. Also returns email, name and id of the currently logged in user.
content:
application/json:
schema:
properties:
expires:
type: string
format: date-time
description: "Date and time of token expiration"
example: "2022-01-30T08:30:00Z"
token:
type: string
description: "Value of the authentication token"
example: "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
id:
type: integer
description: "The ID of the current user"
example: 3
name:
type: string
description: "Name of the current user"
example: "John Doe"
email:
type: string
description: "The email of the current user"
example: "test@test.at"
"401":
description: Authorization information is missing or invalid.
/register:
post:
summary: Register new user
requestBody:
content:
application/json:
schema:
properties:
name:
type: string
example: "John Doe"
email:
type: string
example: "test@test.at"
password:
type: "string"
example: 12345
responses:
"200":
description: OK - Returns an authorization token to use in subsequent calls within the HTTP Authorization header. Also returns email, name and id of the currently logged in user.
content:
application/json:
schema:
properties:
id:
type: integer
description: "The ID of the current user"
example: 3
email:
type: string
description: "The email of the current user"
example: "test@test.at"
name:
type: string
description: "Name of the current user"
example: "John Doe"
"400":
description: Authorization information is missing or invalid.
/experiments/{experimentId}:
parameters:
- schema:
type: string
name: experimentId
example: "615c5752d99d8706d46409f9"
in: path
required: true
get:
summary: Get an experiment (and corresponding computation result if available) by experimentId
responses:
"200":
description: OK - Returns the given Experiment. If the status of the experiment is DONE, an "#/components/schemas/ExperimentResult" object will also be returned'.
Only experiments belonging to the current user will be listed.
content:
application/json:
schema:
properties:
experimentConfiguration:
type: object
$ref: "#/components/schemas/Experiment"
experimentResult:
type: object
$ref: "#/components/schemas/ExperimentResult"
"401":
description: Authorization information is missing or invalid.
"404":
description: An Experiment with the specified ID was not found (or does not belong to the current user).
"500":
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
operationId: get-experiments-experimentId
description: Retrieve a specific experiment by ID
delete:
summary: Delete an experiment by experimentId. Is scoped to the current user given in the JWT token
responses:
"204":
description: OK - Experiment deleted successfully
"401":
description: Authorization information is missing or invalid.
"404":
description: An Experiment with the specified ID was not found (or does not belong to the current user).
"500":
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/experiments:
get:
description: Returns all experiments from the system that the user has access to
responses:
"202":
description: Returns a list of all experiments corresponding to the current user given in the JWT token.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Experiment"
"204":
description: The request was processed successfully but no experiments bound to the current user have beend found.
"401":
description: Authorization information is missing or invalid.
"500":
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Add new experiment
operationId: post-experiments
responses:
"201":
description: Experiment created successfully
content:
application/json:
schema:
type: object
$ref: "#/components/schemas/Experiment"
"401":
description: Authorization information is missing or invalid.
"403":
description: Current quota limit exceeded. Cannot create additional experiments
"404":
description: An Experiment with the specified ID was not found.
"500":
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
description: Add a new experiment in initial status "CREATED"
requestBody:
content:
application/json:
schema:
type: object
$ref: "#/components/schemas/ExperimentBase"
/users/quota:
get:
description: Returns the number of experiments the user is still allowed to run this month.
The backend can compute this quite easily
responses:
"200":
description: Returns the remaining number of experiments the current user is still allowed to perform within the current period.
content:
application/json:
schema:
properties:
remainingExperiments:
type: integer
example: 20
minimum: 0
endOfCurrentQuotaCycle:
type: string
format: date-time
description: "Creation date and time"
example: "2021-01-30T08:30:00Z"
"401":
description: Authorization information is missing or invalid.
"500":
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
ExperimentBase:
properties:
circuitId:
type: integer
description: ID of a valid configuration circuit provided within the circuitLib package
example: 3
minimum: 1
experimentName:
type: string
description: The name of this experiment
example: "P=NP?"
projectId:
type: string
description: The id of the project this experiment is associated with
example: "21ac5193d88d8706d267c9f9"
maxRuntime:
type: integer
description: Maximum runtime of an experiment in seconds.
minimum: 1
maximum: 120
example: 120
ComputeSettings:
allOf:
- $ref: "#/components/schemas/ComputeSettings"
- type: object
type: object
required:
- experiment_name
- circuitId
Experiment:
allOf:
- $ref: "#/components/schemas/ExperimentBase"
- type: object
properties:
id:
type: string
description: The id of this experiment. Will be set by the server.
example: "615c5752d99d8706d46409f9"
status:
type: string
description: The status of the experiment. Will be set by the server.
enum: [IN QUEUE, RUNNING, FAILED, DONE]
ComputeSettings:
type: object
properties:
clusterState:
type: object
properties:
amountQubits:
type: integer
description: Amount of selected Qubits.
example: 4 # range: 1-4
minimum: 1
presetSettings:
type: string
description: Defines the cluster state preset and can either be "linear" or "ghz"
example: "linear"
enum: [linear, ghz]
required:
- amountQubits
- presetSettings
qubitComputing:
type: object
properties:
circuitConfiguration:
type: string
description: The circuit configuration the user chose. Can be any string, also the ConfigID from the library can be used.
example: "horseshoe or ConfigID-12"
circuitAngles:
type: array
items:
$ref: "#/components/schemas/CircuitConfigurationItem"
example:
- circuitAngleName: alpha
circuitAngleValue: 45
- circuitAngleName: beta
circuitAngleValue: 34
required:
- circuitConfiguration
encodedQubitMeasurements:
type: array
items:
$ref: "#/components/schemas/QubitMeasurementItem"
example:
- encodedQubitIndex: 1
theta: 45.2
phi: 22
- encodedQubitIndex: 2
theta: 90
phi: 20.9
CircuitConfigurationItem:
type: object
properties:
circuitAngleName:
type: string
example: "alpha"
circuitAngleValue:
type: number
minimum: 0
maximum: 360
example: 45.9
required:
- circuitAngleName
- circuitAngleValue
QubitMeasurementItem:
type: object
properties:
encodedQubitIndex:
type: integer
minimum: 1
example: 1
theta:
type: number
minimum: 0
maximum: 360
example: 45.9
phi:
type: number
minimum: 0
maximum: 360
example: 99.9
ExperimentResult:
type: object
properties:
startTime:
type: string
format: date-time
description: "Creation date and time"
example: "2021-01-30T08:30:00Z"
totalCounts:
type: integer
description: "Total counts"
example: 3400000
numberOfDetectors:
type: integer
description: "Number of detectors used"
example: 8
singlePhotonRate:
type: number
description: "Single photon rate"
example: 1890000.32
totalTime:
type: integer
description: "Total runtime of experiment in milliseconds"
example: 3123
required:
- startTime
- totalCounts
- numberOfDetectors
- singlePhotonRate
- totalTime
Error:
type: object
properties:
message:
type: string
example: "An error occured"
required:
- message
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: "example HTTP Header: Authorization: 'Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'"