V2 to V4 migration

Hello,

We’ve been using the Frame.io v2 api (via the python SDK) for some time now. Today our users have been unable to get our tools to work. client.teams.list_all() was returning an empty list.

I did some digging and saw there was a new V4 api so I wanted to give that a shot (via the new python SDK). Following the migration guide I added `x-frameio-legacy-token-auth` to the headers so we can continue to use our legacy tokens and now when I run: client.workspaces.index(<user_id>) I get a 401 unauthorized error code. I’m able to get_me().

We have to use the legacy tokens since we currently do not license frame.io through adobe but still through our original plan.

Is there some authorization limitations with the legacy tokens? Is there some other issue I’m not aware of?

import frameio

token = "<token>"

headers = {'x-frameio-legacy-token-auth': 'true'}
client = frameio.Frameio(token=token, headers=headers)

client_data = client.users.show()
account_id = client.users.show().data.id

client.workspaces.index(account_id=account_id) # Raises 401 error.

Thank you for your help!

hi @nathan-vandevoort you are using the user id obtained from /me which is not the account_id. You need to use client.accounts.index() to list the accounts and the ID that’s returned (or if multiple, need to add a way for user to select which one) is what you’d use

1 Like

Hi @nathan-vandevoort!

Following up with a quick example of the changes Charlie mentioned just in case it helps get things unblocked faster. (One thing to note is that this assumes you only have one account ID to work with. If you have multiple, you’ll want to adjust the index):

  import frameio                                                                                                                                                 
   
  token = "<token>"                                                                                                                                              
                  
  client = frameio.Frameio(
      token=token,
      headers={"x-frameio-legacy-token-auth": "true"},
  )                                                                                                                                                              
   
  account_id = client.accounts.index().items[0].id                                                                                                               
                  
  client.workspaces.index(account_id=account_id)  
1 Like

This was exactly the problem. Once I had that piece adopting the new API was very seamless. Thank you for the help!

1 Like