Sample code for 30+ languages & platforms
Pascal (Lazarus/Delphi)

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 Pascal (Lazarus/Delphi) Downloads

Pascal (Lazarus/Delphi)
program ChilkatDemo;

// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  SysUtils,
  CkDllLoader,
  Chilkat.Http,
  Chilkat.StringBuilder,
  Chilkat.JsonObject;

// ---------------------------------------------------------------------------

procedure RunDemo;
var
  success: Boolean;
  http: THttp;
  sbResponseBody: TStringBuilder;
  jResp: TJsonObject;
  respStatusCode: Integer;
  v_type: string;
  account_id: string;
  bio: string;
  context: string;
  deleted_at: string;
  digest_frequency: string;
  email: string;
  email_confirm_by: string;
  email_preferences: string;
  features_seen: string;
  first_login_at: string;
  from_google: Boolean;
  id: string;
  image_128: string;
  image_256: string;
  image_32: string;
  image_64: string;
  inserted_at: string;
  joined_via: string;
  last_seen: string;
  location: string;
  name: string;
  next_digest_date: string;
  phone: string;
  profile_image: string;
  profile_image_original: string;
  roles: string;
  timezone_value: string;
  updated_at: string;
  upload_url: string;
  user_default_color: string;
  user_hash: string;

begin
  success := False;

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

  http := THttp.Create;

  //  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>';

  sbResponseBody := TStringBuilder.Create;
  success := http.QuickGetSb('https://api.frame.io/v2/me',sbResponseBody);
  if (success = False) then
    begin
      WriteLn(http.LastErrorText);
      Exit;
    end;

  jResp := TJsonObject.Create;
  jResp.LoadSb(sbResponseBody);
  jResp.EmitCompact := False;

  WriteLn('Response Body:');
  WriteLn(jResp.Emit());

  respStatusCode := http.LastStatus;
  WriteLn('Response Status Code = ' + respStatusCode);
  if (respStatusCode >= 400) then
    begin
      WriteLn('Response Header:');
      WriteLn(http.LastHeader);
      WriteLn('Failed.');
      Exit;
    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

  v_type := jResp.StringOf('_type');
  account_id := jResp.StringOf('account_id');
  bio := jResp.StringOf('bio');
  context := jResp.StringOf('context');
  deleted_at := jResp.StringOf('deleted_at');
  digest_frequency := jResp.StringOf('digest_frequency');
  email := jResp.StringOf('email');
  email_confirm_by := jResp.StringOf('email_confirm_by');
  email_preferences := jResp.StringOf('email_preferences');
  features_seen := jResp.StringOf('features_seen');
  first_login_at := jResp.StringOf('first_login_at');
  from_google := jResp.BoolOf('from_google');
  id := jResp.StringOf('id');
  image_128 := jResp.StringOf('image_128');
  image_256 := jResp.StringOf('image_256');
  image_32 := jResp.StringOf('image_32');
  image_64 := jResp.StringOf('image_64');
  inserted_at := jResp.StringOf('inserted_at');
  joined_via := jResp.StringOf('joined_via');
  last_seen := jResp.StringOf('last_seen');
  location := jResp.StringOf('location');
  name := jResp.StringOf('name');
  next_digest_date := jResp.StringOf('next_digest_date');
  phone := jResp.StringOf('phone');
  profile_image := jResp.StringOf('profile_image');
  profile_image_original := jResp.StringOf('profile_image_original');
  roles := jResp.StringOf('roles');
  timezone_value := jResp.StringOf('timezone_value');
  updated_at := jResp.StringOf('updated_at');
  upload_url := jResp.StringOf('upload_url');
  user_default_color := jResp.StringOf('user_default_color');
  user_hash := jResp.StringOf('user_hash');


  http.Free;
  sbResponseBody.Free;
  jResp.Free;

end;

// ---------------------------------------------------------------------------

begin

  try
    RunDemo;
  except
    on E: Exception do
      WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
  end;

  WriteLn;
  {$IFDEF MSWINDOWS}
  WriteLn('Press Enter to exit...');
  ReadLn;
  {$ENDIF}
end.