We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
1575475
3 years agoExplorer | Level 3
Error when adding team members to an initally created team folder via http endpoint
I'm making REST calls to the DBX HTTP endpoint from within SAP. My app has full dbx access and all possible rights. Creating a team folder works flawlessly but when trying to add members to that fol...
- 3 years ago
1575475 Apologies for the lack of clarity here. For team folders in particular, you need to add members via groups; you can't add them individually. I'll ask the team to see if we can clarify this in the documentation and error response.
For example, you would set the "members" parameter like:
"members":[{"member":{".tag":"dropbox_id","dropbox_id":"GROUPIDHERE"}}]
You can get group IDs from /2/team/groups/list, etc.
1575475
Explorer | Level 3
Hi Sdrawko, hi Greg,
@Sdrawko:
If you read my post carefully, I never meant that you're Russian 🙂 I just learned the cyrillic alphabet as side effect when learning Russian at school.
And, I know that some baltic countries (and maybe others) also use the cyrillic alphabet. But even in such country you have a chance to communicate using Russian.
Anyway I've to sincerely apologize for the confusion.
Back to business:
I'm using HTTP endpoints only (using REST calls) so no "real" SDK will apply.
The programming language I use is called "ABAP Objects", which is SAP only.
Example:
Endpoint https://api.dropboxapi.com/2/sharing/add_folder_member
In order to add a user to that folder I have to use the "Dropbox-API-Select-Admin: <TEAM_MEMBER_ID>" header parameter as stated here:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-add_folder_member
curl example using the admin authorization is here:
https://www.dropbox.com/developers/reference/auth-types#admin-authentication
curl -X POST "https://api.dropboxapi.com/2/users/get_current_account" \
--header "Authorization: Bearer <OAUTH2_ACCESS_TOKEN>" \
--header "Dropbox-API-Select-Admin: <TEAM_MEMBER_ID>"
I'm performing the following steps:
- create REST API class instance
- open http connection
- fetch new oauth2 token using my secret refresh token (refresh token was generated when authorizing the app the first time) and set header field
->http header field = "Authorization: Bearer <oauth2 token>"
- create header field for admin authorization
->http header field = "Dropbox-API-Select-Admin: dbmid<my team member id>"
- create "request" class instance
- set "Content-Type" to "application/json" via request class (this actually generates the corresponding "Content-Type" header parameter)
- build json string with info about new user, team folder etc.
- set json as request data
- make POST request
- create "response" class instance
- get server response & status
- evaluate response & status
- close http connection
All these steps work flawlessly making REST calls to other endpoints (without admin auth.).
Unfortunately there seems to be no useful example in the documentation making use of the "Dropbox-API-Select-Admin" parameter.
At least I wasn't able to find one.
So, please understand: I cannot see any reason why I'm getting this popup, since I DO send a Bearer token.
Here's the ABAP-Objects code with some comments:
...
IF lo_rest_client IS BOUND. "check if class instance has been created
"lo_auth is an instance of a class which handles oauth2 tokens
lo_auth->get_bearer_auth_name_value( IMPORTING es_bearer_auth = ls_auth_bearer ). "fetch new oauth2 token (or use last token if not expired)
IF ls_auth_bearer IS NOT INITIAL.
lo_rest_client->set_request_header( iv_name = ls_auth_bearer-name "Authorization
iv_value = ls_auth_bearer-value ). "Bearer <oauth2 token>
lo_rest_client->set_request_header( iv_name = /karon/cl_dropbox_co=>mc_dbx_par_api_select_admin "Dropbox-API-Select-Admin
iv_value = lv_dbx_team_admin ). "dbmid:<team member id>
lo_rest_client->set_request_header( iv_name = /karon/cl_dropbox_co=>mc_url_par_request_uri "~request_uri
iv_value = `/2/sharing/share_folder` ).
lo_request_entity = lo_rest_client->create_request_entity( ).
lo_request_entity->set_content_type( iv_media_type = /karon/cl_dropbox_co=>mc_content_json ). "application/json
lo_request_entity->set_string_data( iv_data = lv_json ). "json string with parameters
lo_rest_client->post( io_entity = lo_request_entity ).
...
The only reason why I'm sending a Basic token is as response of the authorization popup I'm constantly getting.
IMHO the question is not why I'm getting an error (which is pretty much clear), but why this popup appears.
REST calls to endpoints which require the "Dropbox-API-Select-User" parameter also work without a hitch.
Best regards,
Jan
Здравко
3 years agoLegendary | Level 20
1575475 wrote:...
IMHO the question is not why I'm getting an error (which is pretty much clear), but why this popup appears....
Exactly, that's why you have to redirect your question to platform provider or read the documentation.
As a good troubleshooting step if possible, dump and evaluate raw communication between your client application and server. There might be a useful communication details you may ignored. You can compare the dump to expected format in API explorer (push "Show Code" and select "HTTP request"). You have to add "Dropbox-API-Select-Admin" header as a extra header (through "Show Headers"). I believe such info can be useful for your platform provider too, to figure out what's wrong with your HTTP request.
Good luck.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 3 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!