API access as collaborating external user still getting 404 errors?
I am trying to automate a harvest of files left by a public agency here:
https://app.box.com/v/2016OPDDailyLogs
in an exchange with @@ a few weeks ago I was informed I needed to be listed as a Collaborator in order to do this, and I've now received Viewer permissions! In Box parlance I guess I am considered an "External user".
When I manually login and navigate to the folders, I am indeed recognized as a Viewer. But my API query:
root_folder = client.folder('***number removed for privacy***2').get()
is still returning 404 errors:
boxsdk.exception.BoxAPIException: Message: Not Found Status: 404 Code: not_found Request id: 9oq6t8fw7521q5hv Headers: {'Date': 'Sat, 13 Oct 2018 18:05:10 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '1l2e3uqttjh5lb341katj2vkqlq', 'Age': '0'} URL: https://api.box.com/2.0/folders/***number removed for privacy***2 Method: GET Context info: {'errors': [{'reason': 'invalid_parameter', 'name': 'item', 'message': "Invalid value 'd_8881131962'. 'item' with value 'd_8881131962' not found"}]}
(I couldn't understand the `d_` prefix being added, but this post explains that my folderID is "typed" on your server end.)
what would be the issue now, please?
-
Hello again !
The d_value you're seeing in the error message should match the folder Id you're passing in your call. In this case, it looks like you made this call using the token of your JWT service account (AutomationUser). You can verify by using the get current user call. However, it still doesn't look like this user has been granted collaboration access to this content, hence why you're receiving a 404 not found. The service account can only "find" content its been granted access to through either: being the owner or being a collaborator.
If you add this user as a collaborator on the folder and still receive an error, please provide me with the full body response that includes the request ID and date/time/timezone you received the error so I can take another look in the backend.
If you have any questions/need any clarification let me know!
-
As shown in the attached screen shot, my account is listed as a Viewer for the folder i'm trying to access.
> The d_value you're seeing in the error message should match the folder Id you're passing in your call.
it does, except for the `d_`
> In this case, it looks like you made this call using the token of your JWT service account (AutomationUser).
correct.
> You can verify by using the get current user call.
i'm using the python `boxsdk` module, and this function doesn't seem exposed in that? i tried using the `curl` version:
curl https://api.box.com/2.0/users/me -H "blablabla"
from the command line with the access token returned from my `JWTAuth()` call, but it returns nothing.
Here is a second example of the response I'm receiving, including its `BOX-REQUEST-ID` which should let you find the details in the backend?
boxsdk.exception.BoxAPIException: Message: Not Found Status: 404 Code: not_found Request id: 3ibjn9fw9ek5oo9v Headers: {'Date': 'Mon, 15 Oct 2018 17:05:06 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=31536000', 'Cache-Control': 'no-cache, no-store', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'BOX-REQUEST-ID': '0954vrnnoqf7d7f0o8ckubtquoq', 'Age': '0'} URL: https://api.box.com/2.0/folders/***number removed for privacy***2 Method: GET Context info: {'errors': [{'reason': 'invalid_parameter', 'name': 'item', 'message': "Invalid value 'd_8881131962'. 'item' with value 'd_8881131962' not found"}]}
-
There seems to be some confusion here between the collaboration and the token making the API call.
You're making the API call using a token associated with the service account of your JWT app - the AutomationUser.
However, as shown in your screenshot, you haven't added the AutomationUser as a collaborator, but rather your Box account (Richard Belew). Instead, you need to add the automation user email address as a collaborator.
Best,
Kourtney
-
I (think of myself as:) the same person, as AutomationUser, and as BoxUser `***email address removed for privacy***`.
wrote:
...
Instead, you need to add the automation user email address as a collaborator.The data provider (OPD) has made "me" (***email address removed for privacy***) a collaborator. What should I have them add instead/in addition?
-
:
Sorry for the delay! To be clear, the service account of your application (the AutomationUser) and your Box account are two completely separate accounts. A service account has an email address that we generate, which is going to look something like AutomationUser_249497_IMnqaksArZ@boxdevedition.com. Therefore, a token for your Box account is only going to be able to access content your email address has been added as a collaborator on and a token for your service account is only going to be able to access content the automation user email address has been added as a collaborator on. The automation user email address is what you need your data provider to add as a collaborator on the folder instead of your email address.
To obtain the automation email address, you will want to obtain a token for the service account and then make a call to the get current user endpoint. I would recommend making this easy by using postman.
-
hi again my turn to be slow (traveling).
so i now appreciate that my AutomationUser’s email is not the same as my Box account user’s email.
and since the python boxsdk doesn’t support it, i hear you recommending Postman as a (new, to me) mechanism to get my automation user email address? so i’m trying to do that:
- i first do a GET Request Authorization, with my client_id (screen shot attached)
- i then use the GET Current User’s Info (https://api.box.com/2.0/users/me)
but i get the same null/empty response to it as I got via the command line `curl` request before? (screen shot attached)
same thing if i try GET Email aliases (https://api.box.com/2.0/users/12927765/email_aliases)
please advise? -
Let's focus on the get current user endpoint example for now.
Here's an example of all you need to input:
I usually use my developer token here while I'm just testing things out to make it easy.
If you fill it in just like my example and still receive an error could you please provide me with your client ID, a date/time/timezone and the full body response?
-
now we got rhythm!
i'm attaching a screen shot of my trying what you describe. i used my developer's token.
don't think i should provide my clientID as clear text in this forum, tho? do you have an email i could use?
my local timestamp: Wed Oct 24 12:04:36 PDT 2018
as shown in the screen shot, body is empty.
-
Client IDs are okay to provide publically. Client secrets/tokens are what you never want to display publically. However, if you're still uncomfortable with providing it here, you'll need to open a support ticket. Good news is that I work on the support team so if you open a ticket and provide me with the ticket number I'd be happy to grab it so you're guaranteed to have me continue working on it.
サインインしてコメントを残してください。
コメント
11件のコメント