mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Describe the creation of parameters/attachments workaround in API docs
Related to issue #502
This commit is contained in:
parent
c8cde94ee3
commit
e5b9ce9c25
1 changed files with 26 additions and 1 deletions
|
@ -175,4 +175,29 @@ which will be
|
||||||
visible in the log of the entity.
|
visible in the log of the entity.
|
||||||
|
|
||||||
You can pass the text for this via the `_comment` query parameter (beware the proper encoding). For
|
You can pass the text for this via the `_comment` query parameter (beware the proper encoding). For
|
||||||
example `/api/parts/123?_comment=This%20is%20a%20change%20comment`.
|
example `/api/parts/123?_comment=This%20is%20a%20change%20comment`.
|
||||||
|
|
||||||
|
## Creating attachments and parameters
|
||||||
|
|
||||||
|
{: .warning }
|
||||||
|
> The way described below is more a workaround than a proper solution. This might break in future versions of Part-DB!
|
||||||
|
|
||||||
|
Currently it is not possible to create attachments or parameters via a `POST` operation on the entity endpoint.
|
||||||
|
The workaround for this is to send a patch request to the owning entity endpoint (e.g. parts `/api/parts/123`):
|
||||||
|
|
||||||
|
```
|
||||||
|
PATCH /api/parts/123
|
||||||
|
|
||||||
|
{
|
||||||
|
"attachments": [
|
||||||
|
{"name": "front68", "attachment_type": "/api/attachment_types/1", "url": "https://invalid.invalid/test.url"}
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{"name": "value", "unit": "Ohm", "value": 100}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The limitation of this is, that this will override/delete all existing attachments/parameters of the entity.
|
||||||
|
|
||||||
|
See [issue #502](https://github.com/Part-DB/Part-DB-server/issues/502) for more details on this topic.
|
Loading…
Add table
Add a link
Reference in a new issue