Java
Java
Frame.io - Get Account ID
See more Frame.io Examples
Make a GET /me request if you don't have your Account ID on hand:Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
// Implements the following CURL command:
// curl \
// -H "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" \
// https://api.frame.io/v2/me
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// Adds the "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" header.
http.put_AuthToken("<FRAME_IO_DEV_TOKEN>");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = http.QuickGetSb("https://api.frame.io/v2/me",sbResponseBody);
if (success == false) {
System.out.println(http.lastErrorText());
return;
}
CkJsonObject jResp = new CkJsonObject();
jResp.LoadSb(sbResponseBody);
jResp.put_EmitCompact(false);
System.out.println("Response Body:");
System.out.println(jResp.emit());
int respStatusCode = http.get_LastStatus();
System.out.println("Response Status Code = " + respStatusCode);
if (respStatusCode >= 400) {
System.out.println("Response Header:");
System.out.println(http.lastHeader());
System.out.println("Failed.");
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "_type": "user",
// "account_id": "b1cd046b-a3bf-4ef8-81a6-0afd74ecc455",
// "bio": null,
// "context": null,
// "deleted_at": null,
// "digest_frequency": "*/5 * * * *",
// "email": "admin@chilkatsoft.com",
// "email_confirm_by": null,
// "email_preferences": null,
// "features_seen": null,
// "first_login_at": "2020-08-18T02:20:56.732000Z",
// "from_google": false,
// "id": "34b4f98a-7cc9-4159-8f46-c7c3d837fc6f",
// "image_128": null,
// "image_256": null,
// "image_32": null,
// "image_64": null,
// "inserted_at": "2020-08-18T02:20:13.145929Z",
// "joined_via": "organic",
// "last_seen": "2020-08-18T02:20:52.852871Z",
// "location": null,
// "name": "Chilkat Software",
// "next_digest_date": "2020-08-18T02:20:13.145828Z",
// "phone": null,
// "profile_image": "https://static-assets.frame.io/app/anon.jpg",
// "profile_image_original": null,
// "roles": null,
// "timezone_value": "America/New_York",
// "updated_at": "2020-08-18T02:20:56.950455Z",
// "upload_url": "https://frameio-uploads-production.s3-accelerate.amazonaws.com/users/34b4f...cdcfe42b2e2f",
// "user_default_color": "#ff40ff",
// "user_hash": "1D39653455C86A85CA3D479C6D2ACE831211BC1B65770DF3747116DD320C3A00"
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
String v_type = jResp.stringOf("_type");
String account_id = jResp.stringOf("account_id");
String bio = jResp.stringOf("bio");
String context = jResp.stringOf("context");
String deleted_at = jResp.stringOf("deleted_at");
String digest_frequency = jResp.stringOf("digest_frequency");
String email = jResp.stringOf("email");
String email_confirm_by = jResp.stringOf("email_confirm_by");
String email_preferences = jResp.stringOf("email_preferences");
String features_seen = jResp.stringOf("features_seen");
String first_login_at = jResp.stringOf("first_login_at");
boolean from_google = jResp.BoolOf("from_google");
String id = jResp.stringOf("id");
String image_128 = jResp.stringOf("image_128");
String image_256 = jResp.stringOf("image_256");
String image_32 = jResp.stringOf("image_32");
String image_64 = jResp.stringOf("image_64");
String inserted_at = jResp.stringOf("inserted_at");
String joined_via = jResp.stringOf("joined_via");
String last_seen = jResp.stringOf("last_seen");
String location = jResp.stringOf("location");
String name = jResp.stringOf("name");
String next_digest_date = jResp.stringOf("next_digest_date");
String phone = jResp.stringOf("phone");
String profile_image = jResp.stringOf("profile_image");
String profile_image_original = jResp.stringOf("profile_image_original");
String roles = jResp.stringOf("roles");
String timezone_value = jResp.stringOf("timezone_value");
String updated_at = jResp.stringOf("updated_at");
String upload_url = jResp.stringOf("upload_url");
String user_default_color = jResp.stringOf("user_default_color");
String user_hash = jResp.stringOf("user_hash");
}
}