Where did my folder go ??
Hi, I created a folder using following code. I logged into my box account from my web browser hoping to see the folder in my root directory. But, I don't see it. Is there a way to access the files/folders created using the API ?
auth = JWTAuth( client_id='XXX', client_secret='XXX', enterprise_id='XXX', jwt_key_id='XXX', rsa_private_key_file_sys_path='rsa_private_key_file', rsa_private_key_passphrase="XXX") ) access_token = auth.authenticate_instance() client = Client(auth) root_folder = client.folder(folder_id='0').get() foo = root_folder.create_subfolder('foo') try: print('Folder {0} created'.format(foo.get()['name'])) bar = foo.rename('bar') print('Renamed to {0}'.format(bar.get()['name'])) finally: print('nothing')
-
The folder was created in your application's service account root folder. If you are testing with a Box developer account, you can see the folder in the Admin Console within the Content Manager page.
To create the folder in your Box account's root folder, you have to specify your account with your user id and the As-User header. Here's how to do that the Python SDK:
user = client.user(user_id='USER_ID') client.as_user(user).folder(folder_id='0').create_subfolder('FOLDER_NAME')
-
Struggling with the same problem here. I can't go to the 'https://app.box.com/master/content' address to see anything even though I'm an admin (trial account if it helps).
"To create the folder in your Box account's root folder, you have to specify your account with your user id"
Who's user id? The enterprise user? Where do I get the id? -
You can get a list of user ids from the Get Enterprise Users endpoint. Once you find the user id needed, you would set that as the value of the As-User header.
サインインしてコメントを残してください。
コメント
3件のコメント