Lua
Lua
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 Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
-- 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.auth_token = "<FRAME_IO_DEV_TOKEN>"
local sbResponseBody = chilkat.StringBuilder.new()
local success = http:quick_get_sb("https://api.frame.io/v2/me", sbResponseBody)
if not success then
print(http.last_error_text)
return
end
local jResp = chilkat.JsonObject.new()
jResp:load_sb(sbResponseBody)
jResp.emit_compact = false
print("Response Body:")
print(jResp:emit())
local respStatusCode = http.last_status
print("Response Status Code = " .. respStatusCode)
if respStatusCode >= 400 then
print("Response Header:")
print(http.last_header)
print("Failed.")
return
end
-- 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
local v_type = jResp:string_of("_type")
local account_id = jResp:string_of("account_id")
local bio = jResp:string_of("bio")
local context = jResp:string_of("context")
local deleted_at = jResp:string_of("deleted_at")
local digest_frequency = jResp:string_of("digest_frequency")
local email = jResp:string_of("email")
local email_confirm_by = jResp:string_of("email_confirm_by")
local email_preferences = jResp:string_of("email_preferences")
local features_seen = jResp:string_of("features_seen")
local first_login_at = jResp:string_of("first_login_at")
local from_google = jResp:bool_of("from_google")
local id = jResp:string_of("id")
local image_128 = jResp:string_of("image_128")
local image_256 = jResp:string_of("image_256")
local image_32 = jResp:string_of("image_32")
local image_64 = jResp:string_of("image_64")
local inserted_at = jResp:string_of("inserted_at")
local joined_via = jResp:string_of("joined_via")
local last_seen = jResp:string_of("last_seen")
local location = jResp:string_of("location")
local name = jResp:string_of("name")
local next_digest_date = jResp:string_of("next_digest_date")
local phone = jResp:string_of("phone")
local profile_image = jResp:string_of("profile_image")
local profile_image_original = jResp:string_of("profile_image_original")
local roles = jResp:string_of("roles")
local timezone_value = jResp:string_of("timezone_value")
local updated_at = jResp:string_of("updated_at")
local upload_url = jResp:string_of("upload_url")
local user_default_color = jResp:string_of("user_default_color")
local user_hash = jResp:string_of("user_hash")