forked from Sunbird-RC/open-saber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensaber_api_spec.yaml
163 lines (158 loc) · 4.8 KB
/
opensaber_api_spec.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
# API Spec for Open-Saber Registry Application
swagger: '2.0'
info:
title: Open-Saber
description: APIs for Open-saber registry
version: "1.0.0"
# the domain of the service
host: io.open-saber
# array of all schemes that your API supports
schemes:
- http
# will be prefixed to all paths
basePath: /
produces:
- application/json
paths:
/addEntity:
post:
summary: Add record
description: |
Add record endpoint adds a record of a defined type into the registry
and returns response which includes whether the operation was successful
or whether it was a failure and message indicating the reason for failure.
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: requestObject
description: Request body
required: true
schema:
$ref: '#/definitions/Entity'
responses:
200:
description: Status of the operation
schema:
$ref: '#/definitions/AddOpSuccessResponse'
/getEntity:
get:
summary: Get record
description: |
Get record endpoint gets a record from the registry based on the unique identifier
and returns the record in the response.
produces:
- application/json
parameters:
- in: query
name: id
description: Unique identifier for the record
required: true
type: string
responses:
200:
description: id of the object created and the status of the operation
schema:
$ref: '#/definitions/GetOpSuccessResponse'
/entity:
patch:
summary: Update record
description: |
Update record endpoint updates a record of a defined type into the registry
and returns whether the operation was successful or unsuccessful as part of
the response. Update record end point either updates the properties of the
nodes under the root node or create child nodes if no id is provided.
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: requestObject
description: Request body
required: true
schema:
$ref: '#/definitions/Entity'
responses:
200:
description: Status of the operation
schema:
$ref: '#/definitions/AddOpSuccessResponse'
definitions:
Entity:
type: object
properties:
id:
type: string
description: Unique identifier respresenting the api
ver:
type: string
description: Version of the API
ets:
type: integer
description: Timestamp(in seconds) at which the request was sent
format: int64
params:
type: object
properties:
did:
type: string
description: Device id from which the request originates
key:
type: string
description: API key for accessing the API
msgid:
type: string
description: Unique msg id for the request
request:
type: object
description: This is JSON-LD data which represents the actual record which is inserted into the registry
AddOpSuccessResponse:
type: object
properties:
id:
type: string
description: Unique identifier representing the response of the operation
ver:
type: string
description: Version of the API
ets:
type: integer
description: Timestamp(in seconds) at which the response was sent
format: int64
params:
type: object
properties:
status:
type: string
description: status of the operation indicating SUCCESSFUL or UNSUCCESSFUL
resultMap:
type: object
properties:
entity:
type: string
description: Unique identifier representing the record
GetOpSuccessResponse:
type: object
properties:
id:
type: string
description: Unique identifier representing the response of the operation
ver:
type: string
description: Version of the API
ets:
type: integer
description: Timestamp(in seconds) at which the response was sent
format: int64
params:
type: object
properties:
status:
type: string
description: status of the operation indicating SUCCESSFUL or UNSUCCESSFUL
resultMap:
type: object
description: This represents the record retrieved from the registry