Skip to content

Commit db27cf5

Browse files
committed
Add submit values docs
1 parent aaddd24 commit db27cf5

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

source/includes/_custom_fields.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,41 @@ curl https://api.simplyprint.io/{id}custom_fields/Delete?ids=123,124,125 \
217217
| `status` | boolean | True if the request was successful. |
218218
| `message` | string | Error message if `status` is false. |
219219

220+
## Custom field submission
221+
222+
`POST /{id}/custom_fields/SubmitValues`
223+
224+
> Example request
225+
226+
```shell
227+
curl -X POST https://api.simplyprint.io/{id}/custom_fields/SubmitValues \
228+
-H 'accept: application/json' \
229+
-H 'Content-Type: application/json' \
230+
-H 'X-API-KEY: {API_KEY}' \
231+
-d '{"category": "printer", "subCategory": "print_job", entityIds: [1234], "values": [{customFieldId: "student_id", value: {"string": "1234567890"}}]}'
232+
```
233+
234+
> Example response
235+
236+
```json
237+
{
238+
"status": true,
239+
"message": null
240+
}
241+
```
242+
243+
### Request
244+
245+
| Parameter | Type | Required | Description |
246+
|---------------|--------|----------|------------------------------------------------------------------------------------------------------------------|
247+
| `category` | string | yes | One of `print`, `user`, `printer`, `filament` |
248+
| `subCategory` | string | yes | One of `print_queue`, `print_job`, `user_file` |
249+
| `entityIds` | array | yes | Array of entity IDs to submit values for |
250+
| `values` | array | yes | Array of custom field values to submit. Each value looks like `{customFieldId: string, value: CustomFieldValue}` |
251+
220252
## Custom field submission value
221253

222-
The value of a custom field when submitted via the API is an object with a key corresponding to the field type.
254+
The value of a custom field when submitted via the API is an object with a key corresponding to the field type.
223255
See the examples to the right for the different field types.
224256

225257
> A text field would have a value like this:
@@ -258,6 +290,9 @@ See the examples to the right for the different field types.
258290
259291
```json
260292
{
261-
"options": ["Option 1", "Option 2"]
293+
"options": [
294+
"Option 1",
295+
"Option 2"
296+
]
262297
}
263298
```

0 commit comments

Comments
 (0)