Closed noqqe closed 5 years ago
Hi,
If i understand you correctly, you are trying to create a new item. To create a new item use POST
. PATCH
is only for updating.
If you POST
, you only need to specify name
and cost
and on successful creation you'll get the id
of the newly created item in the response.
.... in theory ;-)
Ah, well. Thats right. Solved my problem.
Using items_post
instead of items_item_id_patch
now.
Hi,
I recently tried to use the
items_item_id_patch
Methodhttps://github.com/k4cg/matomat-service/blob/master/maas-client-tty/swagger_client/api/items_api.py#L408
Its defined as
So as a client, I need to calculate the item_id I want the drink to have in the future. Im not sure if this is intended. I would have assumed i just set
name
andcost
and theitem_id
is being generated from the backend for my newly created item.I wanted to bring that up for discussion. However, i did not want the user to be asked to type the item_id so i worked around this with this simple hack
It fetches all Items, gets last object in list and adds 1 to the id