Bryanne Vega avatar image
Bryanne Vega asked ·

Category Object cannot get Items

I'm trying to parse all items in a category.

From the REST API, I pull a category, then:

List<Item> categoryItems = lastSelectedCategory.getItems();

But I get an error on the editor:

Incompatible types:

Required com.clover.sdk.v3.Inventory.Item

Found com.clover.sdk.v3.base.Reference

I've done this with other objects, I'm only having this issue with the items from a category object.

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.

In other words, why is Item item = lastSelectedCategory.getItems().get(i); returning a Reference instead of an item?

0 Likes 0 ·

That means the element isn't expanded. You are getting item IDs not Items. You'll need to fetch each Item object by ID.

0 Likes 0 ·

edit see comment below

0 Likes 0 ·

This error is happening while editing code, not on run time, running the query appending ?expand=items will get me my items without having to fetch each of them.

0 Likes 0 ·

0 Answers

Welcome to the
Clover Developer Community