question

Bryanne Vega avatar image
Bryanne Vega asked Bryanne Vega commented

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.

5 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.

Bryanne Vega avatar image Bryanne Vega commented ·

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

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

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 ·
Bryanne Vega avatar image Bryanne Vega commented ·

edit see comment below

0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·

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 ·
Bryanne Vega avatar image Bryanne Vega commented ·
0 Likes 0 ·

0 Answers

Welcome to the
Clover Developer Community