We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
matthewepler
8 years agoExplorer | Level 4
Adding tags to team files
Hi there. I'm trying to add custom tags to files shared by a team. I'm unable to add properties and get a returned reponse "Restricted content." Searched for answers, didn't find any that helped.
Perhaps I'm not using the API as designed? These are the steps I've taken:
1. Create a template (with an admin-level token) using "/2/file_properties/templates/add_for_team"
2. Add properties (with a non-admin-level token) using "/2/file_properties/properties/add"
In step #1, I get a response with a template id, that's good.
In step #2, I specify fields with the same name as I set in the template so that they match. I use a token that is issued at a User level (not Business).
But no dice. What am I doing wrong? Here are the requests:
1:
curl -X POST https://api.dropboxapi.com/2/file_properties/templates/add_for_team \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"name":"Tags","description":"tags template","fields":[{"name":"practice","description":"equity, transformation, etc.","type":{".tag":"string"}},{"name":"project","description":"Kuja Kuja, Steps, etc.","type":{".tag":"string"}},{"name":"partner","description":"Chase, ARC, etc.","type":{".tag":"string"}},{"name":"filetype","description":"png, ai, pdf, etc.","type":{".tag":"string"}},{"name":"medium","description":"web, mobile, print, etc.","type":{".tag":"string"}},{"name":"category","description":"report, wireframes, template, capture, etc.","type":{".tag":"string"}}]}'
2:
curl -X POST https://api.dropboxapi.com/2/file_properties/properties/add \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"path":"/Dev Assets/design_library/design_library_mockup.png","property_groups":[{"template_id":"ptid:g1CLXU7Z6l8AAAAAAEJ1KA","fields":[{"name":"practice","value":".org"},{"name":"project","value":"design library"},{"name":"partner","value":"daniel feldman, michael zhong"},{"name":"filetype","value":"png"},{"name":"medium","value":"web"},{"name":"category","value":"mockup"},{"name":"contributors","value":"daniel fledman, michael zhong"}]}]}'
The /2/file_properties/properties/add endpoint documents 'restricted_content' as "You do not have permission to modify this template." That can happen for a few reasons, but it sounds like in your case you're using a user access token (e.g., for a "Full Dropbox" app) to try to add file properties for a team-owned template, created via a team access token (for a "team member file access" app).
Since you used /2/file_properties/templates/add_for_team to create the template, the resulting template is owned by the team and you'll need to use a team access token for that team to use that template.
To call a user endpoint, such as /2/file_properties/properties/add, with a team access token, you should use the "member file access" feature.
5 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
The /2/file_properties/properties/add endpoint documents 'restricted_content' as "You do not have permission to modify this template." That can happen for a few reasons, but it sounds like in your case you're using a user access token (e.g., for a "Full Dropbox" app) to try to add file properties for a team-owned template, created via a team access token (for a "team member file access" app).
Since you used /2/file_properties/templates/add_for_team to create the template, the resulting template is owned by the team and you'll need to use a team access token for that team to use that template.
To call a user endpoint, such as /2/file_properties/properties/add, with a team access token, you should use the "member file access" feature.
- matthewepler8 years agoExplorer | Level 4
Okay, thanks for the link. I'll check it out.
To clarify:
- to add tags to files shared by a team, there must be a template created with a team-owned token.
- to add tags, the request must be made with a team-owned token on behalf of an existing user
is that correct? Is this the best way to accomplish what I'm doing. The goal is create a UI for searching shared documents by tags.
Thanks!
- Greg-DB8 years ago
Dropbox Community Moderator
That's almost correct, but to clarify, there are two different kinds of property templates: user-owned (created by /2/file_properties/templates/add_for_user) and team-owned (created by /2/file_properties/templates/add_for_team).
To add file properties to a file for a team-owned property template, you need to use a team token.
You don't technically need to use a team-owned template to add file properties to a file that happens to be shared with the team. (Sharing and file properties aren't connected.)
If you want the file properties to be accessible to any user on the team though, your configuration of using a team-owned template sounds like the best setup.
- matthewepler8 years agoExplorer | Level 4Thanks for clarifying, Greg. So if a user uses a user template to create tags on a document, those are not visible to other users. Is that right? Only if I use a team template?
- Greg-DB8 years ago
Dropbox Community Moderator
That's correct.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 3 days ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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!