Skip to content

Commit 6031b2e

Browse files
Added batch baking to Readme. Tweaks to swagger
1 parent fc4bc01 commit 6031b2e

File tree

2 files changed

+90
-4
lines changed

2 files changed

+90
-4
lines changed

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,92 @@ Response:
170170
}
171171
```
172172

173+
### `/batch/bake`
174+
175+
`/batch/bake` allows a user to POST multiple input values and a configuration for a CyberChef Recipe. The application will run each elemnt of the input through the recipe and return the results as an array of output objects.
176+
177+
This endpoint accepts a POST request with the following body:
178+
179+
|Parameter|Type|Description|
180+
|---|---|---|
181+
input|Array|The input data for the recipe. Currently accepts an array of Strings.
182+
recipe|String or Object or Array|One or more operations, with optional arguments. Uses default arguments if they're not defined here.
183+
outputType (optional)|String|The [Data Type](https://github.com/gchq/CyberChef/wiki/Adding-a-new-operation#data-types) that you would like the result of the bakes to be returned as. This will not work with `File` or `List<File>` at the moment.
184+
185+
#### Example: one operation, default arguments
186+
```javascript
187+
{
188+
"input": ["One", "two", "three", "four"],
189+
"recipe": "to decimal"
190+
}
191+
```
192+
193+
Response:
194+
```javascript
195+
[
196+
{
197+
"success": true,
198+
"value": "79 110 101",
199+
"type": "string"
200+
},
201+
{
202+
"success": true,
203+
"value": "116 119 111",
204+
"type": "string"
205+
},
206+
{
207+
"success": true,
208+
"value": "116 104 114 101 101",
209+
"type": "string"
210+
},
211+
{
212+
"success": true,
213+
"value": "102 111 117 114",
214+
"type": "string"
215+
}
216+
]
217+
218+
```
219+
> For more information on how operation names are handled, see the [Node API docs](https://github.com/gchq/CyberChef/wiki/Node-API#operation-names)
220+
221+
#### Example: one operation, non-default arguments by name
222+
```javascript
223+
{
224+
"input": ["One", "two", "three", "four"],
225+
"recipe": {
226+
"op": "to decimal",
227+
"args": {
228+
"delimiter": "Colon"
229+
}
230+
}
231+
}
232+
```
233+
Response:
234+
```javascript
235+
[
236+
{
237+
"success": true,
238+
"value": "79:110:101",
239+
"type": "string"
240+
},
241+
{
242+
"success": true,
243+
"value": "116:119:111",
244+
"type": "string"
245+
},
246+
{
247+
"success": true,
248+
"value": "116:104:114:101:101",
249+
"type": "string"
250+
},
251+
{
252+
"success": true,
253+
"value": "102:111:117:114",
254+
"type": "string"
255+
}
256+
]
257+
```
258+
173259
### `/magic`
174260

175261
[Find more information about what the Magic operation does here](https://github.com/gchq/CyberChef/wiki/Automatic-detection-of-encoded-data-using-CyberChef-Magic)

swagger.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ paths:
126126
post:
127127
summary: Bakes a batch of data with a recipe
128128
description: >
129-
Bake a recipe defined in JSON over and array of input data. For an example JSON recipe, build a recipe on
130-
[CyberChef](https://gchq.github.io/CyberChef/) and click save. Select "clean JSON".
129+
Bake a recipe defined in JSON over an array of input data. To obtain a JSON-formatted recipe, build a recipe on
130+
[CyberChef](https://gchq.github.io/CyberChef/) and click save. Select "clean JSON" and copy the output.
131131
132132
Input data must be in the form of an array. All items will be baked individually
133133
and an individual result object provided for each in the response
@@ -163,10 +163,10 @@ paths:
163163
- type: "string"
164164
value: "01001110"
165165
success: true
166-
- error: "Bad Recipe"
166+
- error: "Spline reticulation exception"
167167
success: false
168168
'400':
169-
description: Bad request
169+
description: Bad request, most often a syntactically invalid recipe
170170

171171
components:
172172
schemas:

0 commit comments

Comments
 (0)