cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding tags to team files

Adding tags to team files

matthewepler
Explorer | Level 4
Go to solution

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"}]}]}'

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

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.

matthewepler
Explorer | Level 4
Go to solution

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-DB
Dropbox Staff
Go to solution

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.

matthewepler
Explorer | Level 4
Go to solution
Thanks 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-DB
Dropbox Staff
Go to solution
That's correct.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    matthewepler Explorer | Level 4
What do Dropbox user levels mean?