Hallo zusammen,
mein Body ist null wenn ich unten stehenden Request ausführe. Es kommt aber 200 und folgende Antwort:
{"inventory_levels":[{"inventory_item_id":39303418839201,"location_id":55759470753,"available":200,"updated_at":"2021-01-15T15:58:00+01:00","admin_graphql_api_id":"gid:\\/89940000929?inventory_item_id=39303418839201"}]}
Ich habe in meinem InventoryItem zwar neben der Liste auch ein IventoryItem als nicht Liste (nutze ich an anderer Stelle) dieses sollte eigentlich null sein, während die Liste aber den Eintrag haben sollte.
Hab das @JsonProperty auch schon über den Getter gemacht, kein Erfolg. Hat jemand ne Idee? getForEntity bringt ebenfalls null
[CODE lang="java" title="InventoryItem"]@JsonInclude(JsonInclude.Include.NON_NULL)
public class InventoryResponse{
@JsonProperty("inventory_levels")
private List<InventoryItem> inventoryLevels;
@JsonProperty("inventory_level")
private InventoryItem inventoryLevel;
public InventoryResponse(List<InventoryItem> inventoryLevels, InventoryItem inventoryLevel) {
this.inventoryLevels = inventoryLevels;
this.inventoryLevel = inventoryLevel;
}
//Getter Setter
}[/CODE]
[CODE=java]@JsonInclude(JsonInclude.Include.NON_NULL)
public class InventoryItem{
@JsonProperty("inventory_item_id")
private Long inventoryItemId;
@JsonProperty("available")
private Integer available;
@JsonProperty("cost")
private String cost;
@JsonProperty("location_id")
private Long locationId;
public InventoryItem() {
}
//Getter Setter
}
[/CODE]
[CODE=java]RestTemplate restTemplate = new RestTemplate();
ResponseEntity<InventoryResponse> response = restTemplate.exchange(url, HttpMethod.GET, entity, InventoryResponse.class);
[/CODE]