Search code examples
javaandroidkumulos

What is returned from Kumulos API


I made a method in Kumulos to check login details. It is supposed to return the (Entry)ID of account logged in but when I run that API from Kumulos website I get this.

0: object (click to toggle)
accountName->MYNAME
password->YUPMYPASS
credentialID->9
timeCreated->2016-11-28 07:09:13
timeUpdated->2016-11-28 07:11:11

So how do I use this in my code? It returns an Object on calling a method from the android studio. I don't know anything about that object's type. How do I extract credentialID from that object?

This is the Syntax to call my API i used.

   params.put(username, password);
   Kumulos.call("login", params, new ResponseHandler() {
   @Override
   public void didCompleteWithResult(Object result) {
        //this is the Object returned 

     }
    });

Solution

  • I'm Chris from Kumulos. The result object can be cast down to an List of Map interfaces, which you can then extract the fields from like so:

    ArrayList<LinkedHashMap<String, Object>> objects = (ArrayList<LinkedHashMap<String,Object>>) result;
    LinkedHashMap<String,Object> firstObject = objects.get(0);
    int id = Integer.valueOf(String.valueOf(firstObject.get("credentialID")));
    

    This example is adapted form the integration guide here: https://docs.kumulos.com/integration/android/#select-actions

    If you have any further or more specific questions, we'd encourage you to reach out to our support team by emailing support@kumulos.com

    Thanks, Chris