Swift
Swift
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 Swift Downloads
func chilkatTest() {
var success: Bool = false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
// 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.authToken = "<FRAME_IO_DEV_TOKEN>"
let sbResponseBody = CkoStringBuilder()!
success = http.quickGetSb(url: "https://api.frame.io/v2/me", sbContent: sbResponseBody)
if success == false {
print("\(http.lastErrorText!)")
return
}
let jResp = CkoJsonObject()!
jResp.loadSb(sb: sbResponseBody)
jResp.emitCompact = false
print("Response Body:")
print("\(jResp.emit()!)")
var respStatusCode: Int = http.lastStatus.intValue
print("Response Status Code = \(respStatusCode)")
if respStatusCode >= 400 {
print("Response Header:")
print("\(http.lastHeader!)")
print("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
var v_type: String? = jResp.string(of: "_type")
var account_id: String? = jResp.string(of: "account_id")
var bio: String? = jResp.string(of: "bio")
var context: String? = jResp.string(of: "context")
var deleted_at: String? = jResp.string(of: "deleted_at")
var digest_frequency: String? = jResp.string(of: "digest_frequency")
var email: String? = jResp.string(of: "email")
var email_confirm_by: String? = jResp.string(of: "email_confirm_by")
var email_preferences: String? = jResp.string(of: "email_preferences")
var features_seen: String? = jResp.string(of: "features_seen")
var first_login_at: String? = jResp.string(of: "first_login_at")
var from_google: Bool = jResp.bool(of: "from_google")
var id: String? = jResp.string(of: "id")
var image_128: String? = jResp.string(of: "image_128")
var image_256: String? = jResp.string(of: "image_256")
var image_32: String? = jResp.string(of: "image_32")
var image_64: String? = jResp.string(of: "image_64")
var inserted_at: String? = jResp.string(of: "inserted_at")
var joined_via: String? = jResp.string(of: "joined_via")
var last_seen: String? = jResp.string(of: "last_seen")
var location: String? = jResp.string(of: "location")
var name: String? = jResp.string(of: "name")
var next_digest_date: String? = jResp.string(of: "next_digest_date")
var phone: String? = jResp.string(of: "phone")
var profile_image: String? = jResp.string(of: "profile_image")
var profile_image_original: String? = jResp.string(of: "profile_image_original")
var roles: String? = jResp.string(of: "roles")
var timezone_value: String? = jResp.string(of: "timezone_value")
var updated_at: String? = jResp.string(of: "updated_at")
var upload_url: String? = jResp.string(of: "upload_url")
var user_default_color: String? = jResp.string(of: "user_default_color")
var user_hash: String? = jResp.string(of: "user_hash")
}