Skip to content

Add missing endpoints, edit responses #11

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 17 commits into from
Oct 6, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add submit values docs
  • Loading branch information
johanohly committed Sep 11, 2024
commit db27cf5d04ced562d15aa06377090a67fc16c6d2
39 changes: 37 additions & 2 deletions source/includes/_custom_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,41 @@ curl https://api.simplyprint.io/{id}custom_fields/Delete?ids=123,124,125 \
| `status` | boolean | True if the request was successful. |
| `message` | string | Error message if `status` is false. |

## Custom field submission

`POST /{id}/custom_fields/SubmitValues`

> Example request

```shell
curl -X POST https://api.simplyprint.io/{id}/custom_fields/SubmitValues \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {API_KEY}' \
-d '{"category": "printer", "subCategory": "print_job", entityIds: [1234], "values": [{customFieldId: "student_id", value: {"string": "1234567890"}}]}'
```

> Example response

```json
{
"status": true,
"message": null
}
```

### Request

| Parameter | Type | Required | Description |
|---------------|--------|----------|------------------------------------------------------------------------------------------------------------------|
| `category` | string | yes | One of `print`, `user`, `printer`, `filament` |
| `subCategory` | string | yes | One of `print_queue`, `print_job`, `user_file` |
| `entityIds` | array | yes | Array of entity IDs to submit values for |
| `values` | array | yes | Array of custom field values to submit. Each value looks like `{customFieldId: string, value: CustomFieldValue}` |

## Custom field submission value

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

> A text field would have a value like this:
Expand Down Expand Up @@ -258,6 +290,9 @@ See the examples to the right for the different field types.

```json
{
"options": ["Option 1", "Option 2"]
"options": [
"Option 1",
"Option 2"
]
}
```
Loading