Sample code for 30+ languages & platforms
Zig

Frame.io - Get Team ID

See more Frame.io Examples

Get your team ID.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    const http = try chilkat.Http.init();
    defer http.deinit();

    // Implements the following CURL command:

    // curl \
    //     -H "Authorization: Bearer <FRAME_IO_DEV_TOKEN>" \
    //     https://api.frame.io/v2/accounts/<ACCOUNT_ID>/teams

    // 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.setAuthToken("<FRAME_IO_DEV_TOKEN>");

    http.setUrlVar("account_id", "b1cd046b-a3bf-4ef8-81a6-0afd74ecc455") catch {};

    const sb_response_body = try chilkat.StringBuilder.init();
    defer sb_response_body.deinit();
    http.quickGetSb("https://api.frame.io/v2/accounts/{$account_id}/teams", sb_response_body) catch {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        return;
    };

    const j_resp = try chilkat.JsonObject.init();
    defer j_resp.deinit();
    j_resp.loadSb(sb_response_body) catch {};
    j_resp.setEmitCompact(false);

    std.debug.print("Response Body:\n", .{});
    std.debug.print("{s}\n", .{try j_resp.emit(alloc)});

    const resp_status_code = http.getLastStatus();
    std.debug.print("Response Status Code = {d}\n", .{resp_status_code});
    if (resp_status_code >= 400) {
        std.debug.print("Response Header:\n", .{});
        std.debug.print("{s}\n", .{try http.getLastHeader(alloc)});
        std.debug.print("Failed.\n", .{});
        return;
    }

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "image_64": null,
    //   "project_count": 1,
    //   "default_color": "5B53FF",
    //   "deleted_at": null,
    //   "image_256": null,
    //   "background_color": null,
    //   "session_watermark_templates": [
    //   ],
    //   "font_color": null,
    //   "email_branding": {
    //     "_type": "email_branding",
    //     "accent_color": null,
    //     "background_color": null,
    //     "default_accent_color": "5B53FF",
    //     "default_background_color": "F7F8FA",
    //     "id": "71cddf30-cdd6-4db9-9f1f-f119c3a6c36d",
    //     "image": null,
    //     "upload_url": "https://frameio-uploads-production.s3-accelerate.amazonaws.com/email_branding/71c...508199e26038"
    //   },
    //   "bio": null,
    //   "updated_at": "2020-08-18T02:20:14.432078Z",
    //   "link": null,
    //   "default_font_color": "20222B",
    //   "image_128": null,
    //   "dark_theme": false,
    //   "disable_sbwm_internally": false,
    //   "account_id": "b1cd046b-a3bf-4ef8-81a6-0afd74ecc455",
    //   "name": "Chilkat's Team",
    //   "location": null,
    //   "solo": false,
    //   "watermark": null,
    //   "file_count": 0,
    //   "duration": 0,
    //   "image_32": null,
    //   "team_image": null,
    //   "default_background_color": "FFFFFF",
    //   "resource_id": "8e32b1ae-86db-4164-83b1-81b37b2e7499",
    //   "color": null,
    //   "frames": 0,
    //   "storage": 0,
    //   "collaborator_count": 1,
    //   "creator_id": "34b4f98a-7cc9-4159-8f46-c7c3d837fc6f",
    //   "default_session_watermark_template_id": null,
    //   "archived_storage": 0,
    //   "slack_webhook": null,
    //   "upload_url": "https://frameio-uploads-production.s3-accelerate.amazonaws.com/teams/95a5fb..a86b2663",
    //   "member_count": 1,
    //   "_type": "team",
    //   "asset_lifecycle_policy": null,
    //   "member_limit": null,
    //   "id": "95a5fbad-688d-46fc-aef1-2f011dd76c10",
    //   "storage_limit": null,
    //   "access": "private",
    //   "inserted_at": "2020-08-18T02:20:13.171582Z",
    //   "folder_count": 0
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    _ = try j_resp.stringOf(alloc, "image_64");
    _ = j_resp.intOf("project_count");
    _ = try j_resp.stringOf(alloc, "default_color");
    _ = try j_resp.stringOf(alloc, "deleted_at");
    _ = try j_resp.stringOf(alloc, "image_256");
    _ = try j_resp.stringOf(alloc, "background_color");
    _ = try j_resp.stringOf(alloc, "font_color");
    _ = try j_resp.stringOf(alloc, "email_branding._type");
    _ = try j_resp.stringOf(alloc, "email_branding.accent_color");
    _ = try j_resp.stringOf(alloc, "email_branding.background_color");
    _ = try j_resp.stringOf(alloc, "email_branding.default_accent_color");
    _ = try j_resp.stringOf(alloc, "email_branding.default_background_color");
    _ = try j_resp.stringOf(alloc, "email_branding.id");
    _ = try j_resp.stringOf(alloc, "email_branding.image");
    _ = try j_resp.stringOf(alloc, "email_branding.upload_url");
    _ = try j_resp.stringOf(alloc, "bio");
    _ = try j_resp.stringOf(alloc, "updated_at");
    _ = try j_resp.stringOf(alloc, "link");
    _ = try j_resp.stringOf(alloc, "default_font_color");
    _ = try j_resp.stringOf(alloc, "image_128");
    _ = j_resp.boolOf("dark_theme");
    _ = j_resp.boolOf("disable_sbwm_internally");
    _ = try j_resp.stringOf(alloc, "account_id");
    _ = try j_resp.stringOf(alloc, "name");
    _ = try j_resp.stringOf(alloc, "location");
    _ = j_resp.boolOf("solo");
    _ = try j_resp.stringOf(alloc, "watermark");
    _ = j_resp.intOf("file_count");
    _ = j_resp.intOf("duration");
    _ = try j_resp.stringOf(alloc, "image_32");
    _ = try j_resp.stringOf(alloc, "team_image");
    _ = try j_resp.stringOf(alloc, "default_background_color");
    _ = try j_resp.stringOf(alloc, "resource_id");
    _ = try j_resp.stringOf(alloc, "color");
    _ = j_resp.intOf("frames");
    _ = j_resp.intOf("storage");
    _ = j_resp.intOf("collaborator_count");
    _ = try j_resp.stringOf(alloc, "creator_id");
    _ = try j_resp.stringOf(alloc, "default_session_watermark_template_id");
    _ = j_resp.intOf("archived_storage");
    _ = try j_resp.stringOf(alloc, "slack_webhook");
    _ = try j_resp.stringOf(alloc, "upload_url");
    _ = j_resp.intOf("member_count");
    _ = try j_resp.stringOf(alloc, "_type");
    _ = try j_resp.stringOf(alloc, "asset_lifecycle_policy");
    _ = try j_resp.stringOf(alloc, "member_limit");
    _ = try j_resp.stringOf(alloc, "id");
    _ = try j_resp.stringOf(alloc, "storage_limit");
    _ = try j_resp.stringOf(alloc, "access");
    _ = try j_resp.stringOf(alloc, "inserted_at");
    _ = j_resp.intOf("folder_count");
}