Skip to content

updating open api spec for agent batching #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions api/openapi-spec/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ paths:
$ref: '#/components/responses/UnauthorizedToken'
requestBody:
$ref: '#/components/requestBodies/TokenContext'
/v1/batch:
post:
summary: Batch multiple API endpoints into one request.
description: |
You can use the Batch endpoint to do things like
1. Make activate decisions for a batch of users in a short timeframe for testing purposes
2. Gather responses from a bunch of activate calls into one response for comparison or analysis
responses:

'200':
$ref: '#/components/responses/BatchResponse'
'400':
description: Bad request, invalid parameters.
'422':
description: Unprocessable Entity, too many operations
requestBody:
$ref: '#/components/requestBodies/BatchContext'

components:
parameters:
disableTrackingParam:
Expand Down Expand Up @@ -183,6 +201,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/TokenContext'
BatchContext:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchContext'
responses:
Forbidden:
description: You do not have necessary permissions for the resource
Expand All @@ -196,6 +220,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/TokenError'
BatchResponse:
description: responses for each endpoint called in the batch request
content:
application/json:
schema:
$ref: '#/components/schemas/BatchResponse'
schemas:
Error:
properties:
Expand Down Expand Up @@ -340,6 +370,116 @@ components:
type: string
client_secret:
type: string
BatchContext:
properties:
operations:
type: array
items:
$ref: '#/components/schemas/BatchOperation'
required:
- operations

BatchOperation:
properties:
method:
type: string
enum:
- GET
- POST
url:
type: string
operationID:
type: string
body:
type: object
parameters:
type: object
headers:
type: object
example:
method: "GET"
url: "/v1/config"
operationID: 1
body: {}
parameters: {}
headers: {"X-Optimizely-SDK-Key": "<sdk_key>"}

BatchResponse:
properties:
startedAt:
type: string
endedAt:
type: string
errorCount:
type: integer
response:
type: array
items:
$ref: '#/components/schemas/BatchResponseItem'

BatchResponseItem:
properties:
status:
type: integer
enum:
- 200
- 400
requestID:
type: string
operationID:
type: string
method:
type: string
enum:
- GET
- POST
url:
type: string
body:
type: object
startedAt:
type: string
endedAt:
type: string

example:
status: 200
requestID: "abee6bdf-6d14-4fac-8357-769f5fd07e7c"
operationID: "1"
method: POST
url: "/v1/activate"
body: [
{
"enabled": true,
"experimentKey": "new_feature_test",
"featureKey": "new_feature",
"type": "feature",
"userId": "user1",
"variables": {
"bool_var": true,
"double_var": 5.6,
"int_var": 1,
},
"variationKey": "variation_2"
},

{
"enabled": false,
"experimentKey": "flag_test_2",
"featureKey": "test_feature",
"type": "feature",
"userId": "user1",
"variables": {
"double": 0,
"json_key": {}
},
"variationKey": ""
}
]

startedAt: "2020-09-10T10:50:37.466121-07:00"
endedAt: "2020-09-10T10:50:37.466192-07:00"

securitySchemes:
SdkKeyAuth:
in: header
Expand Down