Skip to content

Commit b83cfaf

Browse files
authored
Merge pull request #48 from runZeroInc/add-export-pagination
Add pagination to export APIs
2 parents 08c1df5 + ec74d9e commit b83cfaf

File tree

1 file changed

+110
-24
lines changed

1 file changed

+110
-24
lines changed

runzero-api.yml

Lines changed: 110 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,32 @@ paths:
140140
- $ref: '#/components/parameters/orgID'
141141
- $ref: '#/components/parameters/search'
142142
- $ref: '#/components/parameters/fields'
143+
- $ref: '#/components/parameters/pageSize'
144+
- $ref: '#/components/parameters/startKey'
143145
get:
144146
tags:
145147
- Export
146148
operationId: exportAssetsJSON
147149
summary: Exports the asset inventory
148150
responses:
149151
'200':
150-
description: filtered asset results
152+
description: Filtered asset results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of assets.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with an assets array and a `next_key` string for pagination.</li></ul>
151153
content:
152154
application/json:
153155
schema:
154-
type: array
155-
items:
156-
$ref: '#/components/schemas/Asset'
156+
oneOf:
157+
- type: array
158+
items:
159+
$ref: '#/components/schemas/Asset'
160+
- type: object
161+
properties:
162+
assets:
163+
type: array
164+
items:
165+
$ref: '#/components/schemas/Asset'
166+
next_key:
167+
type: string
168+
description: The key to use for the next page of results
157169
'401':
158170
$ref: '#/components/responses/UnauthorizedError'
159171

@@ -224,20 +236,32 @@ paths:
224236
- $ref: '#/components/parameters/orgID'
225237
- $ref: '#/components/parameters/search'
226238
- $ref: '#/components/parameters/fields'
239+
- $ref: '#/components/parameters/pageSize'
240+
- $ref: '#/components/parameters/startKey'
227241
get:
228242
tags:
229243
- Export
230244
operationId: exportServicesJSON
231245
summary: Service inventory as JSON
232246
responses:
233247
'200':
234-
description: filtered service results
248+
description: Filtered service results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of services.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with a services array and a `next_key` string for pagination.</li></ul>
235249
content:
236250
application/json:
237251
schema:
238-
type: array
239-
items:
240-
$ref: '#/components/schemas/Service'
252+
oneOf:
253+
- type: array
254+
items:
255+
$ref: '#/components/schemas/Service'
256+
- type: object
257+
properties:
258+
services:
259+
type: array
260+
items:
261+
$ref: '#/components/schemas/Service'
262+
next_key:
263+
type: string
264+
description: The key to use for the next page of results
241265
'401':
242266
$ref: '#/components/responses/UnauthorizedError'
243267

@@ -353,20 +377,32 @@ paths:
353377
- $ref: '#/components/parameters/orgID'
354378
- $ref: '#/components/parameters/search'
355379
- $ref: '#/components/parameters/fields'
380+
- $ref: '#/components/parameters/pageSize'
381+
- $ref: '#/components/parameters/startKey'
356382
get:
357383
tags:
358384
- Export
359385
operationId: exportWirelessJSON
360386
summary: Wireless inventory as JSON
361387
responses:
362388
'200':
363-
description: filtered wireless results
389+
description: Filtered wireless results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of wireless.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with a wireless array and a `next_key` string for pagination.</li></ul>
364390
content:
365391
application/json:
366392
schema:
367-
type: array
368-
items:
369-
$ref: '#/components/schemas/Wireless'
393+
oneOf:
394+
- type: array
395+
items:
396+
$ref: '#/components/schemas/Wireless'
397+
- type: object
398+
properties:
399+
wireless:
400+
type: array
401+
items:
402+
$ref: '#/components/schemas/Wireless'
403+
next_key:
404+
type: string
405+
description: The key to use for the next page of results
370406
'401':
371407
$ref: '#/components/responses/UnauthorizedError'
372408

@@ -417,20 +453,32 @@ paths:
417453
- $ref: '#/components/parameters/orgID'
418454
- $ref: '#/components/parameters/search'
419455
- $ref: '#/components/parameters/fields'
456+
- $ref: '#/components/parameters/pageSize'
457+
- $ref: '#/components/parameters/startKey'
420458
get:
421459
tags:
422460
- Export
423461
operationId: exportSoftwareJSON
424462
summary: Exports the software inventory
425463
responses:
426464
'200':
427-
description: filtered software results
465+
description: Filtered software results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of software.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with a software array and a `next_key` string for pagination.</li></ul>
428466
content:
429467
application/json:
430468
schema:
431-
type: array
432-
items:
433-
$ref: '#/components/schemas/Software'
469+
oneOf:
470+
- type: array
471+
items:
472+
$ref: '#/components/schemas/Software'
473+
- type: object
474+
properties:
475+
software:
476+
type: array
477+
items:
478+
$ref: '#/components/schemas/Software'
479+
next_key:
480+
type: string
481+
description: The key to use for the next page of results
434482
'401':
435483
$ref: '#/components/responses/UnauthorizedError'
436484

@@ -481,20 +529,32 @@ paths:
481529
- $ref: '#/components/parameters/orgID'
482530
- $ref: '#/components/parameters/search'
483531
- $ref: '#/components/parameters/fields'
532+
- $ref: '#/components/parameters/pageSize'
533+
- $ref: '#/components/parameters/startKey'
484534
get:
485535
tags:
486536
- Export
487537
operationId: exportVulnerabilitiesJSON
488538
summary: Export the vulnerability inventory as JSON
489539
responses:
490540
'200':
491-
description: filtered vulnerability results
541+
description: Filtered vulnerability results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of vulnerabilities.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with an vulnerabilites array and a `next_key` string for pagination.</li></ul>
492542
content:
493543
application/json:
494544
schema:
495-
type: array
496-
items:
497-
$ref: '#/components/schemas/Vulnerability'
545+
oneOf:
546+
- type: array
547+
items:
548+
$ref: '#/components/schemas/Vulnerability'
549+
- type: object
550+
properties:
551+
vulnerabilities:
552+
type: array
553+
items:
554+
$ref: '#/components/schemas/Vulnerability'
555+
next_key:
556+
type: string
557+
description: The key to use for the next page of results
498558
'401':
499559
$ref: '#/components/responses/UnauthorizedError'
500560

@@ -3256,15 +3316,27 @@ paths:
32563316
required: false
32573317
schema:
32583318
type: string
3319+
- $ref: '#/components/parameters/pageSize'
3320+
- $ref: '#/components/parameters/startKey'
32593321
responses:
32603322
'200':
3261-
description: filtered event results
3323+
description: Filtered event results. <ul><li>When the `page_size` query parameter is not set in the request, the response will be a JSON array of events.</li><li>When the `page_size` query parameter is present in the request, the response will be an object with an events array and a `next_key` string for pagination.</li></ul>
32623324
content:
32633325
application/json:
32643326
schema:
3265-
type: array
3266-
items:
3267-
$ref: '#/components/schemas/Event'
3327+
oneOf:
3328+
- type: array
3329+
items:
3330+
$ref: '#/components/schemas/Event'
3331+
- type: object
3332+
properties:
3333+
events:
3334+
type: array
3335+
items:
3336+
$ref: '#/components/schemas/Event'
3337+
next_key:
3338+
type: string
3339+
description: The key to use for the next page of results
32683340
'401':
32693341
$ref: '#/components/responses/UnauthorizedError'
32703342

@@ -4502,6 +4574,20 @@ components:
45024574
schema:
45034575
type: string
45044576
description: A list of fields to export, comma-separated
4577+
pageSize:
4578+
in: query
4579+
name: page_size
4580+
required: false
4581+
schema:
4582+
type: integer
4583+
description: The number of results to return per request.
4584+
startKey:
4585+
in: query
4586+
name: start_key
4587+
required: false
4588+
schema:
4589+
type: string
4590+
description: The value to use for requesting the next page when requesting paginated results. This should be the value of the `next_key` attribute returned in the previous response.
45054591
securitySchemes:
45064592
bearerAuth:
45074593
type: http

0 commit comments

Comments
 (0)