/
apiary.apib
261 lines (195 loc) · 7.44 KB
/
apiary.apib
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
FORMAT: 1A
HOST: http://funhub-devel.gunet.gr/
# SSN API (amka-services)
## About this API
This API provides a resource to view, manage and validate information
about SSN (AMKA) numbers and their related metadata.
## Business Process
Here we define what this API's purpose is, it's workflows and what are
the paths one may follow to accomplish particular tasks.
1. Check if a given SSN has been registered, optionally validating some personal attributes
2. Retrieve a set of personal attributes associated with the given SSN
## Use Cases: state transitions.
1. An API client will discover the available resources by accessing the API endpoint.
2. An API client will search for a given SSN value in the collection of registered SSN's, optionally including some personal attributes for validation.
3. An API client will request the personal attributes of a given registered SSN.
## Media types in use
Currently the API uses [Collection+JSON](http://amundsen.com/media-types/collection/) as
in it's responses.
## Authentication
API Authentication is provided via the standard `Authorization` HTTP header. Authentication methods supported include
`Token` and `Signature`. The first method requires the client simply providing a shared secret, while
the second method is implemented according to the [IETF http-signature](https://datatracker.ietf.org/doc/draft-cavage-http-signatures/) standard.
# Home [/]
This is the home resource. An API client
+ Model (application/vnd.collection+json)
{
"collection" :
{
"version" : "1.0",
"href" : "...",
"links": [
{
"href": "https://git.gunet.gr/web-services/amka-services-spec/raw/master/profiles/SSN.xml",
"rel": "profile"
},
{
"href": "...",
"rel": "ssn-collection"
}
]
}
}
## API Discovery [GET]
* Request
* Headers
Accept: application/vnd.collection+json
Authorization: Token XXX
* Response 200
[Home][]
# Group SSN resources
# SSN Collection [/ssn/{?familyName,birthDate,ssn}]
A collection of SSN resources.
+ Model (application/vnd.collection+json;profile=https://git.gunet.gr/web-services/amka-services-spec/raw/master/profiles/ValidateSSN.xml)
+ Parameters
+ familyName: `Παπαδόπουλος` (text, optional) - surname or family name to validate with.
+ birthDate: `1981-05-10` (date, optional) - birth date in ISO 8061 format.
+ ssn: `12093134234` (text) - the SSN to validate with
+ Body
{
"collection" :
{
"version" : "1.0",
"href" : "...",
"items": [
{
"href": "...",
"data": [
{
"name": "ssn",
"value": "12093134234"
}
]
}
],
"queries": [
{
"href": "...",
"rel": "validate-ssn",
"prompt": "Validate an SSN and personal attributes",
"data": [
{
"name": "familyName",
"value": ""
},
{
"name": "birthDate",
"value": ""
},
{
"name": "ssn",
"value": ""
}
]
}
]
}
}
## Validate SSN [GET]
This action retrieves a list of SSN resources from the collection. Currently,
the resource supports retrieving at most one SSN resource, based on the value
of the `ssn` parameter. Additionally one may provide `familyName` and `birthDate` to validate the data
against the specific SSN.
+ Relation: validate-ssn
+ Request Validate an SSN with personal attributes
+ Headers
Accept: application/vnd.collection+json
Authorization: Token XXX
+ Response 200
[SSN Collection][]
+ Response 200
If the SSN is not registered
+ Body
{
"collection" :
{
"version" : "1.0",
"href" : "..."
}
}
+ Request Fail to validate SSN's personal attributes
+ Headers
Accept: application/vnd.collection+json
Authorization: Token XXX
+ Response 400 (application/vnd.collection+json;profile=https://git.gunet.gr/web-services/amka-services-spec/raw/master/profiles/ValidateSSN.xml)
If the SSN is registered but the parameters provided do not validate the response contains no items and an error is reported.
+ Body
{
"collection" :
{
"version" : "1.0",
"href" : "...",
"error": {
"title" : "Invalid data",
"code" : "ssnerr002,
"message" : "The parameters provided to do not validate for the given SSN"
}
}
}
+ Request Unauthenticated request
+ Headers
Accept: application/vnd.collection+json
+ Response 403 (application/vnd.collection+json;profile=https://git.gunet.gr/web-services/amka-services-spec/raw/master/profiles/ValidateSSN.xml)
In case the client doesn't provide satisfactory authentication credentials the API responds with 403 HTTP Forbidden.
+ Body
{
"collection" :
{
"version" : "1.0",
"href" : "...",
"error": {
"title" : "Forbidden",
"code" : "ssnerr001,
"message" : "Valid authentication was not provided. Please try again with correct authentication."
}
}
}
# SSN Entry [/ssn/{ssn}]
A resource for a registered SSN.
+ Model (application/vnd.collection+json;profile=https://git.gunet.gr/web-services/amka-services-spec/raw/master/profiles/ValidateSSN.xml)
+ Body
{
"collection" :
{
"version" : "1.0",
"href" : "...",
"links": [
{
"rel": "collection",
"href": "..."
}
],
"items": [
{
"href": "...",
"data": [
{
"name": "ssn",
"value": "12093134234"
}
]
}
]
}
}
## Retrieve SSN [GET]
This action retrieves specific SSN resource
+ Relation: ssn-entry
+ Parameters
+ ssn: `12093134234` (text) - the SSN to validate with
+ Request
+ Headers
Accept: application/vnd.collection+json
+ Response 200
[SSN Entry][]
+ Response 404