question

jmalone30 avatar image
jmalone30 asked ·

Using REST API, how do I add an item to a category in the same Create Inventory call?

Using REST API, how do I add an item to a category in the same Create Inventory call?

I am successfuly creating an inventory item using the following:

https://docs.clover.com/reference#inventorycreateitem-1

My question is, how do I add the item to a category in the same call? Or do I have to make a second call to Category_Items once I have the new item id?

https://docs.clover.com/reference#categorycreateordeletecategoryitems-1


The same question applies to stock quantity. Can I add an inventory item within a category and with a stock quantity all in a single call?

REST APIInventory
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rey avatar image
rey answered ·

If we have to make a second call, why are all the fields available. The cURL creator automatically creates the JSON code for you. This is confusing.

Here is what I get when I populate the appropriate fields. However, the categories and itemStock fields

curl

--request POST \

--url 'https://sandbox.dev.clover.com/v3/merchants/mId/items

--header 'Content-Type: application/json' \

--data '{
"hidden":"false",
"defaultTaxRates":"true",
"isRevenue":true,
"categories":[{"items":[],"canonical":{},"name":"Polo Shirt"}],
"itemStock":{"quantity":15},
"name":"Test1",
"sku":"ACC-TE-TEST123",
"price":25000,
"priceType":"FIXED",
"cost":5000,
"alternateName":"testing api item creation",
"code":"123456"
}'

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I understand it is confusing. Unfortunately, our docs are automatically generated and we haven't been able to find a clean solution to this.

1 Like 1 ·
David Marginian avatar image
David Marginian answered ·

You need to make a subsequent call.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community