Examples

Initialize SDK

import org.arvados.sdk.Arvados;
    String apiName = "arvados";
    String apiVersion = "v1";

    Arvados arv = new Arvados(apiName, apiVersion);

create

    Map<String, String> collection = new HashMap<String, String>();
    collection.put("name", "create example");

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("collection", collection);
    Map response = arv.call("collections", "create", params);

delete

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("uuid", uuid);
    Map response = arv.call("collections", "delete", params);

get

    params = new HashMap<String, Object>();
    params.put("uuid", userUuid);
    Map response = arv.call("users", "get", params);

list

    Map<String, Object> params = new HashMap<String, Object>();
    Map response = arv.call("users", "list", params);

    // get uuid of the first user from the response
    List items = (List)response.get("items");

    Map firstUser = (Map)items.get(0);
    String userUuid = (String)firstUser.get("uuid");

update

    Map<String, String> collection = new HashMap<String, String>();
    collection.put("name", "update example");

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("uuid", uuid);
    params.put("collection", collection);
    Map response = arv.call("collections", "update", params);

Get current user

    Map<String, Object> params = new HashMap<String, Object>();
    Map response = arv.call("users", "current", params);

Previous: Installation Next: Installation

The content of this documentation is licensed under the Creative Commons Attribution-Share Alike 3.0 United States licence.
Code samples in this documentation are licensed under the Apache License, Version 2.0.