Sample code for 30+ languages & platforms
SQL Server

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 SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

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

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- 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.
    EXEC sp_OASetProperty @http, 'AuthToken', '<FRAME_IO_DEV_TOKEN>'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.frame.io/v2/me', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        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

    DECLARE @v_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, '_type'
    DECLARE @account_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @account_id OUT, 'account_id'
    DECLARE @bio nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @bio OUT, 'bio'
    DECLARE @context nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @context OUT, 'context'
    DECLARE @deleted_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @deleted_at OUT, 'deleted_at'
    DECLARE @digest_frequency nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @digest_frequency OUT, 'digest_frequency'
    DECLARE @email nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'email'
    DECLARE @email_confirm_by nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @email_confirm_by OUT, 'email_confirm_by'
    DECLARE @email_preferences nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @email_preferences OUT, 'email_preferences'
    DECLARE @features_seen nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @features_seen OUT, 'features_seen'
    DECLARE @first_login_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @first_login_at OUT, 'first_login_at'
    DECLARE @from_google int
    EXEC sp_OAMethod @jResp, 'BoolOf', @from_google OUT, 'from_google'
    DECLARE @id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'id'
    DECLARE @image_128 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @image_128 OUT, 'image_128'
    DECLARE @image_256 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @image_256 OUT, 'image_256'
    DECLARE @image_32 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @image_32 OUT, 'image_32'
    DECLARE @image_64 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @image_64 OUT, 'image_64'
    DECLARE @inserted_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @inserted_at OUT, 'inserted_at'
    DECLARE @joined_via nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @joined_via OUT, 'joined_via'
    DECLARE @last_seen nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @last_seen OUT, 'last_seen'
    DECLARE @location nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @location OUT, 'location'
    DECLARE @name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'name'
    DECLARE @next_digest_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @next_digest_date OUT, 'next_digest_date'
    DECLARE @phone nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @phone OUT, 'phone'
    DECLARE @profile_image nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @profile_image OUT, 'profile_image'
    DECLARE @profile_image_original nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @profile_image_original OUT, 'profile_image_original'
    DECLARE @roles nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @roles OUT, 'roles'
    DECLARE @timezone_value nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @timezone_value OUT, 'timezone_value'
    DECLARE @updated_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @updated_at OUT, 'updated_at'
    DECLARE @upload_url nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @upload_url OUT, 'upload_url'
    DECLARE @user_default_color nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @user_default_color OUT, 'user_default_color'
    DECLARE @user_hash nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @user_hash OUT, 'user_hash'

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO