About Tags

About Tags

Contents

Introduction

The Java SDK allows you to retrieve, create, and delete tags. The following examples include code samples to help you get started with tags.

Examples

deleteTag

public void deleteTag(OAuthToken token, String path) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    client.deleteTags(path);
}

getTag

public String getTag(OAuthToken token, String path) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    // fetch the tag string for the indicated path.
    return client.getTags(path);
}

tagFile

public void tagFile(OAuthToken token, FileMetadata file, String tag) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    // apply the tag to the file.  Any existing tag is overwritten.
    client.setTags(file.getUri(), tag);
}

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.