BrickBytes / bricklink_api

BrickLink API Python library
MIT License
16 stars 12 forks source link

Creating inventory #2

Open alessss opened 3 years ago

alessss commented 3 years ago

Hi! Thanks for cool api, that works fine. But I still can't understand why can't I create inventory items using api?

I'm getting either {'meta': {'description': 'Unparseable value or field: [item.categoryID.]', 'message': 'PARAMETER_MISSING_OR_INVALID', 'code': 400}} OR {"meta":{"description":"Unparseable value or field: []","message":"PARAMETER_MISSING_OR_INVALID","code":400}}

Here is my example of data and add inventory calling:

` data = \ { "item": { "no": "3437", "type": "PART", "categoryID": 417 }, "color_id": 5, "quantity": 12, "new_or_used": "U", "unit_price": 1.2, "bind_id": 0, "description": "", "remarks": "", "bulk": 1, "is_retain": False, "is_stock_room": False, "date_created": "2021-07-28T05:00:00.000Z", "my_cost": 100, "sale_rate": 1, "tier_quantity1": 0, "tier_price1": 0, "tier_quantity2": 0, "tier_price2": 0, "tier_quantity3": 0, "tier_price3": 0 }

x = bricklink_api.user_inventory.create_inventory(data, auth=auth) print(x)`

Thanks in advance!

vandlol commented 2 years ago

hey @alessss - maybe a little late on this one - to my knowledge your inventory items need to be complete - i use a preparation method to line all the details up https://github.com/vandlol/stenchef/blob/747fa1086a4a2020c14ef4249c3d05755ceeb590/stenchef/warehouse/bricklink_integration.py#L305 look at the official api docu to see what is actueally needed https://www.bricklink.com/v3/api.page?page=create-inventory also: category is not needed to create an inventory item hope this helps and you haven't lost hope :)