-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network monitor query returns invalid JSON #55
Comments
Could you add this method withLoggingEnabled() when creating the client and post the logs?
|
It seems the issue is in the API itself and not in the java client, internal error is thrown when sending the same mask in REST Account::getObject
Account::getVirtualGuests
I removed "lastResult" from the mask and I was able to retrieve the networkMonitors, same behavior in java client. @mheitka could you remove or comment lastResult and try again? |
Here is the output with logging enabled:
If I remove lastResult the query works and the output is
I agree that there must be some change in the API itself because the code worked a couple of months ago. But I cannot decide whether the answer is syntactically wrong or there is a problem when parsing the answer on the client side. |
This issue was reported to SoftLayer in order to be fixed. I don't have an ETA, the work around I found is retrieving a little set of data using the result-limits feature, in java client the limits can be set by using the method setResultLimit() but it doesn't work if withMask() is set, this is a known issue #52, so I recommend you to use setMask() instead. The following sample uses limits and retrieves all guests from 8 to 8. ApiClient client = new RestApiClient().withCredentials(username, apiKey);
Account.Service service = Account.service(client);
service.setMask("mask[id,hostname,networkMonitors[id,ipAddress,queryType,responseAction,lastResult,status,waitCycles]]");
// Retrieve and print guests using limits
boolean haveItems = true;
int offset = 0;
int limit = 8;
while(haveItems){
service.setResultLimit(new ResultLimit(offset, limit));
List<Guest> guests = service.getVirtualGuests();
// Print response in JSON format
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(guests));
// verify if there is more items to retrieve
if(!guests.isEmpty()){
offset += limit;
} else {
haveItems = false;
}
} |
I'm not seeing issues with this specific query now. Going ahead and closing the issue. |
Quering network monitors with mask results in
Sample code for this is
The text was updated successfully, but these errors were encountered: