Sample code for 30+ languages & platforms
PureBasic

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 PureBasic Downloads

PureBasic
IncludeFile "CkHttp.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkJsonObject.pb"

Procedure ChilkatExample()

    success.i = 0

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; 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.
    CkHttp::setCkAuthToken(http, "<FRAME_IO_DEV_TOKEN>")

    sbResponseBody.i = CkStringBuilder::ckCreate()
    If sbResponseBody.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkHttp::ckQuickGetSb(http,"https://api.frame.io/v2/me",sbResponseBody)
    If success = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkStringBuilder::ckDispose(sbResponseBody)
        ProcedureReturn
    EndIf

    jResp.i = CkJsonObject::ckCreate()
    If jResp.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckLoadSb(jResp,sbResponseBody)
    CkJsonObject::setCkEmitCompact(jResp, 0)

    Debug "Response Body:"
    Debug CkJsonObject::ckEmit(jResp)

    respStatusCode.i = CkHttp::ckLastStatus(http)
    Debug "Response Status Code = " + Str(respStatusCode)
    If respStatusCode >= 400
        Debug "Response Header:"
        Debug CkHttp::ckLastHeader(http)
        Debug "Failed."
        CkHttp::ckDispose(http)
        CkStringBuilder::ckDispose(sbResponseBody)
        CkJsonObject::ckDispose(jResp)
        ProcedureReturn
    EndIf

    ; 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

    v_type.s = CkJsonObject::ckStringOf(jResp,"_type")
    account_id.s = CkJsonObject::ckStringOf(jResp,"account_id")
    bio.s = CkJsonObject::ckStringOf(jResp,"bio")
    context.s = CkJsonObject::ckStringOf(jResp,"context")
    deleted_at.s = CkJsonObject::ckStringOf(jResp,"deleted_at")
    digest_frequency.s = CkJsonObject::ckStringOf(jResp,"digest_frequency")
    email.s = CkJsonObject::ckStringOf(jResp,"email")
    email_confirm_by.s = CkJsonObject::ckStringOf(jResp,"email_confirm_by")
    email_preferences.s = CkJsonObject::ckStringOf(jResp,"email_preferences")
    features_seen.s = CkJsonObject::ckStringOf(jResp,"features_seen")
    first_login_at.s = CkJsonObject::ckStringOf(jResp,"first_login_at")
    from_google.i = CkJsonObject::ckBoolOf(jResp,"from_google")
    id.s = CkJsonObject::ckStringOf(jResp,"id")
    image_128.s = CkJsonObject::ckStringOf(jResp,"image_128")
    image_256.s = CkJsonObject::ckStringOf(jResp,"image_256")
    image_32.s = CkJsonObject::ckStringOf(jResp,"image_32")
    image_64.s = CkJsonObject::ckStringOf(jResp,"image_64")
    inserted_at.s = CkJsonObject::ckStringOf(jResp,"inserted_at")
    joined_via.s = CkJsonObject::ckStringOf(jResp,"joined_via")
    last_seen.s = CkJsonObject::ckStringOf(jResp,"last_seen")
    location.s = CkJsonObject::ckStringOf(jResp,"location")
    name.s = CkJsonObject::ckStringOf(jResp,"name")
    next_digest_date.s = CkJsonObject::ckStringOf(jResp,"next_digest_date")
    phone.s = CkJsonObject::ckStringOf(jResp,"phone")
    profile_image.s = CkJsonObject::ckStringOf(jResp,"profile_image")
    profile_image_original.s = CkJsonObject::ckStringOf(jResp,"profile_image_original")
    roles.s = CkJsonObject::ckStringOf(jResp,"roles")
    timezone_value.s = CkJsonObject::ckStringOf(jResp,"timezone_value")
    updated_at.s = CkJsonObject::ckStringOf(jResp,"updated_at")
    upload_url.s = CkJsonObject::ckStringOf(jResp,"upload_url")
    user_default_color.s = CkJsonObject::ckStringOf(jResp,"user_default_color")
    user_hash.s = CkJsonObject::ckStringOf(jResp,"user_hash")


    CkHttp::ckDispose(http)
    CkStringBuilder::ckDispose(sbResponseBody)
    CkJsonObject::ckDispose(jResp)


    ProcedureReturn
EndProcedure