forked from Co-Epi/coepi-backend-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoepi_api_0.3.0.yml
139 lines (126 loc) · 5.08 KB
/
coepi_api_0.3.0.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
openapi: 3.0.3
info:
description: This is the API model for CoEpi Server
version: 0.3.0
title: CoEpi Server
license:
name: MIT License
url: https://github.com/Co-Epi/data-models/blob/master/LICENSE
servers:
- url: https://api.example.com/v3 #TODO: Update once the server is set up and deployed
description: URL Endpoint used for dev/test
paths:
/cenreport:
post:
summary: Submit symptom or infection report
description: Users submit symptom / infection reports and reveal the secret CENKey in their application
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
report:
type: string
format: byte # base64 encoded data
description: Content of the infection report. Example, symptoms
cenKeys:
type: array
items:
$ref: '#/components/schemas/CenKey'
minItems: 1
maxItems: 10 # TODO: Discuss appropriate value
uniqueItems: true
example:
report: "c2V2ZXJlIGZldmVyLGNvdWdoaW5nLGhhcmQgdG8gYnJlYXRoZQ=="
cenKeys: [ "2cb87ba2f39a3119e4096cc6e04e68a8","4bb5c242916d923fe3565bd5c6b09dd3" ]
required:
- report
- cenKeys
x-amazon-apigateway-integration:
type: aws_proxy
uri: ${lambda_invoke_arn}
httpMethod: POST
responses:
'200':
description: The report was submitted successfully
'400':
description: Request Parameter Invalid # TBD
'500':
description: Internal Server Error
get:
summary: Returns a list of reports generated between a timestamp range provided through query paramaters. If no range is provided, the returns all reports for the current day. If only timestampLower is provided, returns all reports in the range [timestampLower, now]. Range cannot be greater than 5 days.
parameters:
- in: query
name: timestampLower
description: Lower limit timestamp in UTC for which we need the reports. If not provided, returns all reports for current timestamp
required: false
schema:
$ref: '#/components/schemas/Timestamp'
example: 1585326048
- in: query
name: timestampUpper
description: Upper limit timestamp in UTC for which we need the reports. If not specified, default is the current timestamp
required: false
schema:
$ref: '#/components/schemas/Timestamp'
example: 1585327048
x-amazon-apigateway-integration:
type: aws_proxy
uri: ${lambda_invoke_arn}
httpMethod: POST
responses:
'200':
description: List of infection/symptom reports generated during the hour of the specified timestamp
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Report'
'400':
description: Request Parameter Invalid # TBD
'500':
description: Internal Server Error
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md
components:
schemas:
CenKey:
description: Contact Event Number (CEN) published by the mobile device
type: string
minLength: 5 #TODO: Discuss appropriate value
maxLength: 100 #TODO: Discuss appropriate value and also a possibly an expected pattern
example: "67f48de38f35c231e34e533649ecbfeb"
Timestamp:
type: integer
description: Timestamp in unix epoch format. It is the number of seconds that have elapsed since the Unix epoch, that is the time 00:00:00 UTC on 1 January 1970, minus leap seconds.
minimum: 0
example: 1585551684
Report:
type: object
description: Infection report representing symptoms and/or positive infection incident
properties:
reportId:
type: string
description: Unique Identifier of the infection report
minLength: 1 #TODO: Discuss appropriate value
maxLength: 100 #TODO: Discuss appropriate value and also a possibly an expected pattern (guid ?)
report:
type: string
description: Content of the infection report consisting of symptoms and/or positive infection incident. Base64 encoded
format: byte # base64 encoded data
minLength: 1
maxLength: 10000
cenKeys:
type: array
description: CEN Keys belonging to the device that publushed the report
items:
$ref: '#/components/schemas/CenKey'
reportTimestamp:
$ref: '#/components/schemas/Timestamp'
example:
reportId: "6d68785abd6f99ea646fd7c775a14a36f7cec7635a76d3b5554908c6c3a09af5"
report: "c2V2ZXJlIGZldmVyLGNvdWdoaW5nLGhhcmQgdG8gYnJlYXRoZQ=="
cenKeys: [ "2cb87ba2f39a3119e4096cc6e04e68a8","4bb5c242916d923fe3565bd5c6b09dd3" ]
reportTimestamp: 1585326048