-
Notifications
You must be signed in to change notification settings - Fork 25
Description
I want to print a list of prices to get the right ID to create a subnet. I tried to look for a way to give my account ID through the ApiClient but this didn't need the ID. When I run the code it give me following error:
Exception in thread "main" java.lang.IllegalStateException: ID is required to invoke public abstract java.util.List com.softlayer.api.service.product.item.Price$Service.getPackageReferences()
at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:282)
at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:466)
at com.sun.proxy.$Proxy8.getPackageReferences(Unknown Source)
at applicatie.getPrices(applicatie.java:430)
at applicatie.main(applicatie.java:78)
This is the code I use:
ApiClient client = new RestApiClient()
.withCredentials("OUR USERNAME",
"THE KEY");
getPrices(client,account);
public static void getPrices(ApiClient client, Account account) {
Price.Service servicePrices = Price.service(client);
List<Prices> p = servicePrices.getPackageReferences();
for (Prices price : p) {
System.out.println(price.getId() + price.getItemPriceId());
}
}
Does anyone have the code to print a list of ID's and Names to find the subnet priceId. Or does someone have the code to create one.