question

steve-egan avatar image
steve-egan asked billy-watkins commented

How to create a category using Android SDK

Could I get some help in creating a category using the Android SDK? Currently I have the following code:

Category testCategory = new Category(); testCategory.setName("test"); mInventoryConnector.createCategory(testCategory);

However this is throwing a ClientException. I have no problems creating Items using the InventoryConnector but I cannot figure out what I am doing wrong to create a category. Any help would be greatly appreciated.

Thanks, Steve

10 |2000

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

Jacob Abrams avatar image
Jacob Abrams answered steve-egan commented

Your code looks correct. Are you sure your app has inventory write permission set on the developer dashboard: https://docs.clover.com/build/permiss...

1 comment
10 |2000

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

steve-egan avatar image steve-egan commented ·

Hi Jacobabrams,

Thanks for your response. I definitely have the inventory write permissions set as I can create Items. I searched through devask.clover.com and through the old Google community forum and I did find one post where someone had exactly the same problem. They also got a ClientException. Unfortunately the answer to the problem is no longer on the forum. However the poster noted that the solution was not very intuitive so I suspect it's not as straightforward as what I have coded so far.

Would you have any other ideas as to what I might be doing wrong?

Thanks, Steve

0 Likes 0 ·
billy-watkins avatar image
billy-watkins answered billy-watkins commented
Hi We are having a similar issue with the same code. Did you manage to resolve this?
2 comments
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Can you collect logcat with the error and submit via pastebin?

0 Likes 0 ·
billy-watkins avatar image billy-watkins Jacob Abrams ♦♦ commented ·

There is nothing useful in the logcat https://pastebin.com/5SwLqFiq
however the flow its:

Category newCategory = new Category();
newCategory.setName("TokenPrinter");
mInventoryConnector.createCategory(newCategory);
this throws a client exception statusCode = UNKNOWN; statusMessage = null
if instead I use:
Category newCategory = new Category(); mInventoryConnector.createCategory(newCategory);
this throws a client exception statusCode = 400; statusMessage = Invalid category:Name is required to be non-null
Any Light you can shed on this would be appriciated
0 Likes 0 ·

Welcome to the
Clover Developer Community