Create primary documentation for Jakarta release
[cps/cps-temporal.git] / docs / _static / openapi / swagger / openapi.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021-2022 Bell Canada.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18
19 openapi: 3.0.1
20 info:
21   title: ONAP Open API v3 Configuration Persistence Service - Temporal
22   description: CPS-Temporal is time-series database for network data
23   version: 1.0.0
24   contact:
25     name: ONAP
26     url: 'https://onap.readthedocs.io'
27     email: onap-discuss@lists.onap.org
28   license:
29     name: Apache 2.0
30     url: 'http://www.apache.org/licenses/LICENSE-2.0'
31   x-planned-retirement-date: '202212'
32   x-component: Modeling
33 servers:
34   - url: '/cps-temporal/api'
35 tags:
36   - name: cps-temporal-query
37     description: CPS Temporal Query
38 paths:
39   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/history':
40     get:
41       description: 'Read the data for the specified anchor based on filter criteria provided in query parameters'
42       tags:
43         - cps-temporal-query
44       summary: Get anchor data by name
45       operationId: getAnchorDataByName
46       parameters:
47         - $ref: '#/components/parameters/dataspaceName'
48         - name: anchor-name
49           in: path
50           description: Anchor Name
51           required: true
52           schema:
53             type: string
54             example: my-anchor
55         - $ref: '#/components/parameters/observedTimestampAfter'
56         - $ref: '#/components/parameters/simplePayloadFilter'
57         - $ref: '#/components/parameters/pointInTime'
58         - $ref: '#/components/parameters/pageNumber'
59         - $ref: '#/components/parameters/pageLimit'
60         - $ref: '#/components/parameters/sort'
61       responses:
62         '200':
63           description: OK
64           content:
65             application/json:
66               schema:
67                 $ref: '#/components/schemas/AnchorHistory'
68               example:
69                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=2
70                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=0
71                 records:
72                   - timestamp: '2021-03-21T00:00:00.000-0000'
73                     dataspace: my-dataspace
74                     schemaSet: my-schema-set
75                     anchor: my-anchor
76                     data:
77                       status: UP
78
79
80         '400':
81           $ref: '#/components/responses/BadRequest'
82         '401':
83           $ref: '#/components/responses/Unauthorized'
84         '403':
85           $ref: '#/components/responses/Forbidden'
86   '/v1/dataspaces/{dataspace-name}/anchors/history':
87     get:
88       description: 'Read anchors data based on filter criteria provided in query parameters'
89       tags:
90         - cps-temporal-query
91       summary: Get anchors data based on filter criteria
92       operationId: getAnchorsDataByFilter
93       parameters:
94         - $ref: '#/components/parameters/dataspaceName'
95         - name: schema-set-name
96           in: query
97           description: Schema-set name
98           required: true
99           schema:
100             type: string
101         - $ref: '#/components/parameters/observedTimestampAfter'
102         - $ref: '#/components/parameters/simplePayloadFilter'
103         - $ref: '#/components/parameters/pointInTime'
104         - $ref: '#/components/parameters/pageNumber'
105         - $ref: '#/components/parameters/pageLimit'
106         - $ref: '#/components/parameters/sort'
107       responses:
108         '200':
109           description: OK
110           content:
111             application/json:
112               schema:
113                 $ref: '#/components/schemas/AnchorHistory'
114               example:
115                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=2
116                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=0
117                 records:
118                   - timestamp: '2021-03-21T00:00:00.000-0000'
119                     dataspace: my-dataspace
120                     schemaSet: my-schema-set
121                     anchor: my-anchor
122                     data:
123                       status: UP
124
125         '400':
126           $ref: '#/components/responses/BadRequest'
127         '401':
128           $ref: '#/components/responses/Unauthorized'
129         '403':
130           $ref: '#/components/responses/Forbidden'
131 components:
132   parameters:
133     dataspaceName:
134       name: dataspace-name
135       in: path
136       description: Dataspace Name
137       required: true
138       schema:
139         type: string
140     observedTimestampAfter:
141       name: observedTimestampAfter
142       in: query
143       description: Fetch data with observed timestamp after <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
144       required: false
145       schema:
146         type: string
147         example: '2021-03-21T00:00:00.000-0000'
148     simplePayloadFilter:
149       name: simplePayloadFilter
150       in: query
151       description: Payload filter
152       required: false
153       schema:
154         type: string
155     pointInTime:
156       name: pointInTime
157       in: query
158       description: Consider data modified before <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
159       required: false
160       schema:
161         type: string
162         example: '2021-03-21T00:00:00.000-0000'
163     pageLimit:
164       in: query
165       name: pageLimit
166       required: false
167       schema:
168         type: integer
169         minimum: 0
170         default: 1000
171       description: The numbers of items to return
172     pageNumber:
173       name: pageNumber
174       in: query
175       description: Page number
176       required: false
177       schema:
178         type: integer
179         minimum: 0
180         default: 0
181     sort:
182       in: query
183       name: sort
184       required: false
185       schema:
186         type: string
187         default: observed_timestamp:desc
188       description: "Sort by timestamp in 'asc' or 'desc' order. Supported values: <br/>observed_timestamp:desc<br/>anchor:asc,observed_timestamp:desc"
189   responses:
190     BadRequest:
191       description: Bad Request
192       content:
193         application/json:
194           schema:
195             $ref: '#/components/schemas/ErrorMessage'
196           example:
197             status: 400
198             message: Bad request error message
199             details: Bad request error details
200     Unauthorized:
201       description: Unauthorized
202       content:
203         application/json:
204           schema:
205             $ref: '#/components/schemas/ErrorMessage'
206           example:
207             status: 401
208             message: Unauthorized error message
209             details: Unauthorized error details
210     Forbidden:
211       description: Forbidden
212       content:
213         application/json:
214           schema:
215             $ref: '#/components/schemas/ErrorMessage'
216           example:
217             status: 403
218             message: Forbidden error message
219             details: Forbidden error details
220   schemas:
221     AnchorDetails:
222       type: object
223       title: AnchorDetails
224       properties:
225         observedTimestamp:
226           type: string
227           example: '2021-03-21T00:00:00.000-0000'
228         operation:
229           type: string
230           enum: [CREATE, UPDATE, DELETE]
231           example: UPDATE
232         dataspace:
233           type: string
234           example: 'my-dataspace'
235         schemaSet:
236           type: string
237           example: 'my-schema-set'
238         anchor:
239           type: string
240           example: 'my-anchor'
241         data:
242           type: object
243           example: { "status" : "UP" }
244     AnchorHistory:
245       type: object
246       title: AnchorHistory
247       properties:
248         nextRecordsLink:
249           type: string
250           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=2
251         previousRecordsLink:
252           type: string
253           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=0
254         records:
255           type: array
256           items:
257             $ref: '#/components/schemas/AnchorDetails'
258       required:
259         - records
260     ErrorMessage:
261       type: object
262       title: Error
263       properties:
264         status:
265           type: string
266           example: 400
267         message:
268           type: string
269           example: Data could not be fetched
270         details:
271           type: string
272           example: "after parameter should have datetime value in ISO format yyyy-MM-ddTHH:mm:ss.SSSZ"