Skip to content

Error to get the associated hardware for an account  #2

@raulcabero

Description

@raulcabero

When I call the SoftLayer_Account::getHardware method I got the following error:

Exception in thread "main" java.lang.IllegalStateException: ID is required to invoke public abstract java.util.List com.softlayer.api.service.Account$Service.getHardware()
at com.softlayer.api.RestApiClient$ServiceProxy.invokeService(RestApiClient.java:282)
at com.softlayer.api.RestApiClient$ServiceProxy.invoke(RestApiClient.java:459)
at com.sun.proxy.$Proxy0.getHardware(Unknown Source)
at testJava.testjavaArtifact.Main.main(Main.java:16)

this is my code:

import com.softlayer.api.*;
import com.softlayer.api.service.Account;
import com.softlayer.api.service.Hardware;

public class Main {
public static void main(String[] args) throws Exception {
String user = "set me";
String apikey = "set me";
ApiClient client = new RestApiClient().withCredentials(user, apikey);

    for (Hardware hardware : Account.service(client).getHardware()) {
        System.out.println("Hardware: " + hardware.getFullyQualifiedDomainName());
    }               
}

}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions