<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: file_properties_properties_add() - InternalServerError('', 500, '') in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407507#M22125</link>
    <description>&lt;P&gt;Thanks! It looks like there's just a small issue in that code.&amp;nbsp;The&amp;nbsp;file_properties_properties_add method expects a list of 'PropertyGroup', so instead of:&lt;/P&gt;
&lt;PRE&gt;dbx_api.file_properties_properties_add(p_target_file, property_group)&lt;/PRE&gt;
&lt;P&gt;you should do:&lt;/P&gt;
&lt;PRE&gt;dbx_api.file_properties_properties_add(p_target_file, [property_group])&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Apr 2020 18:54:06 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-04-06T18:54:06Z</dc:date>
    <item>
      <title>file_properties_properties_add() - InternalServerError('', 500, '')</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/406704#M22109</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using Python 3.6 and Dropbox API installed with pip under Linux 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux (WSL Ubuntu).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm short it out everything to be able to add my own properties to the files but, everything fails in the last command, when I tried to execute:&lt;/P&gt;
&lt;P&gt;```&lt;/P&gt;
&lt;P&gt;try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;self.dbx_api.file_properties_properties_add(p_target_file, properties_add)&lt;/P&gt;
&lt;P&gt;except dropbox.exceptions.ApiError as err:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sys.exit("ERROR: Add properties fail for " + p_target_file + " -- Property group alredy exist" + err)&lt;/P&gt;
&lt;P&gt;```&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It just crash retrieving me the next error: InternalServerError('520046d8f13fee9b6959c55e5a304c83', 500, '')&lt;/P&gt;
&lt;P&gt;I would like to add that it takes a few seconds to raise that error, but my file is uploaded and my property_template is added to the user. Also, it should crash if I try to add the same template twice for the same user and I added it like 20 times without any problem, if I list my templates looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GetTemplateResult(name='media_file', description='Properties for media files (photos/videos)', fields=[PropertyFieldTemplate(name='date', description='Date when the file was upload', type=PropertyType('string', None)), PropertyFieldTemplate(name='attraction', description='Attraction where the media was done', type=PropertyType('string', None)), PropertyFieldTemplate(name='park', description='Park where the media was done', type=PropertyType('string', None)), PropertyFieldTemplate(name='uid', description='Uniq identifier for the object', type=PropertyType('string', None)), PropertyFieldTemplate(name='file_type', description='Type of file (video/photo)', type=PropertyType('string', None))])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GetTemplateResult(name='media_file', description='Properties for media files (photos/videos)', fields=[PropertyFieldTemplate(name='date', description='Date when the file was upload', type=PropertyType('string', None)), PropertyFieldTemplate(name='attraction', description='Attraction where the media was done', type=PropertyType('string', None)), PropertyFieldTemplate(name='park', description='Park where the media was done', type=PropertyType('string', None)), PropertyFieldTemplate(name='uid', description='Uniq identifier for the object', type=PropertyType('string', None)), PropertyFieldTemplate(name='file_type', description='Type of file (video/photo)', type=PropertyType('string', None))])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;. . . much more like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what could it be the problem? Do you thing maybe is because WSL, maybe the Python version or API? Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 19:01:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/406704#M22109</guid>
      <dc:creator>ADoncel</dc:creator>
      <dc:date>2020-04-06T19:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: file_properties_properties_add() - InternalServerError('', 500, '')</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/406727#M22111</link>
      <description>&lt;P&gt;Thanks for writing this up! It looks like this happens when you specify the same template multiple times in the same call to&amp;nbsp;&lt;SPAN&gt;file_properties_properties_add, instead of just once. The server error occurs because we don't handle this case properly on the Dropbox API. I'll ask the team to fix up that error handling.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To avoid this though, make sure you only specify a particualr template ID once per call to&amp;nbsp;file_properties_properties_add. That is to say, when you make your&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/file_properties.html#dropbox.file_properties.AddPropertiesArg" target="_self"&gt;AddPropertiesArg&lt;/A&gt;, you can add properties for multiple templates, but you should only specify one &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/file_properties.html#dropbox.file_properties.PropertyGroup" target="_self"&gt;PropertyGroup&lt;/A&gt; in &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/file_properties.html#dropbox.file_properties.AddPropertiesArg.property_groups" target="_self"&gt;AddPropertiesArg.property_groups&lt;/A&gt; per template. If you have multiple fields to set for a template, you should set those multiple fields as a list in the one&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/file_properties.html#dropbox.file_properties.PropertyGroup.fields" target="_self"&gt;PropertyGroup.fields&lt;/A&gt; for the template. Please feel free to share the code where you build your 'properties_add' variable if you'd like more specific help with that.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, regarding "&lt;SPAN&gt;it should crash if I try to add the same template twice for the same user", the&amp;nbsp;Dropbox API allows you to create multiple templates for the same user, so if you do call 'file_properties_templates_add_for_user' multiple times, even with the same parameter values, that will create multiple templates for that user. If only need one template, you should only call that once&amp;nbsp;per user.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 15:44:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/406727#M22111</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-03T15:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: file_properties_properties_add() - InternalServerError('', 500, '')</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407299#M22119</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the answer.&lt;/P&gt;&lt;P&gt;I didn't one PropiertyGroup with more than one field because in that case this error raises:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Exception has occurred: ValidationError -&lt;/STRONG&gt; PropertyGroup(template_id='ptid:iMdPSELQckAAAAAAAAAAIQ', fields=[PropertyField(name='date', value='1548965874'), PropertyField(name='park', value='x'), PropertyField(name='attraction', value='y'), PropertyField(name='file_type', value='video'), PropertyField(name='uid', value='AS46561sdg99wrDSD9e6f1e')]) is not a valid list.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to this, I was passing a list of PropertyGroup, one for each field I need to write and I get the 500 error,&amp;nbsp; so I'm stuck here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I do to create everything in case there is something wrong here:&lt;/P&gt;&lt;PRE&gt;self.dbx_api = dropbox.Dropbox(self.token, timeout=p_timeout)

# Confirm the access token is valid:
try:
    self.dbx_api.users_get_current_account()
except dropbox.exceptions.AuthError:
    sys.exit("ERROR: Invalid access token; try re-generating an access token from the app console on the web or asking to you System Administrator")

string_t = dropbox.file_properties.PropertyType.string
date = dropbox.file_properties.PropertyFieldTemplate(
                'date', 
                'Date when the file was upload', 
                string_t)
park = dropbox.file_properties.PropertyFieldTemplate(
                'park', 
                'Park where the media was done', 
                string_t)
attraction = dropbox.file_properties.PropertyFieldTemplate(
                'attraction', 
                'Attraction where the media was done', 
                string_t)
f_type = dropbox.file_properties.PropertyFieldTemplate(
                'file_type', 
                'Type of file (video/photo)', 
                string_t)
uid = dropbox.file_properties.PropertyFieldTemplate(
                'uid', 
                'Uniq identifier for the object', 
                string_t)

template = self.dbx_api.file_properties_templates_add_for_user(
                'media_file', 
                'Properties for media files (photos/videos)', 
                [date, park, attraction, f_type, uid])

self.template_id = template.template_id

date_property       = dropbox.file_properties.PropertyField('date', p_date)
park_property       = dropbox.file_properties.PropertyField('park', p_park)
attraction_property = dropbox.file_properties.PropertyField('attraction', p_attraction)
f_type_property     = dropbox.file_properties.PropertyField('file_type', p_f_type)
uid_property        = dropbox.file_properties.PropertyField('uid', p_uid)

property_group = dropbox.file_properties.PropertyGroup(
            self.template_id, [date_property, park_property, attraction_property, f_type_property, uid_property])

try:
     self.dbx_api.file_properties_properties_add(p_target_file, property_group)
except dropbox.exceptions.ApiError as err:
     sys.exit("ERROR: Add properties fail for " + p_target_file + " -- Property group alredy exist" + err)&lt;/PRE&gt;&lt;P&gt;In this case I get the error above, and if I try what I explain you the last day:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;property_data = dropbox.file_properties.PropertyGroup(self.template_id, [date_property])
property_park = dropbox.file_properties.PropertyGroup(self.template_id, [park_property])
property_attrac = dropbox.file_properties.PropertyGroup(self.template_id, [attraction_property])
property_type = dropbox.file_properties.PropertyGroup(self.template_id, [f_type_property])
property_uid = dropbox.file_properties.PropertyGroup(self.template_id, [uid_property])

peropety_gr_list = [property_data, property_park, property_attrac, property_type, property_uid]

try:
     self.dbx_api.file_properties_properties_add(p_target_file, peropety_gr_list)
except dropbox.exceptions.ApiError as err:
     sys.exit("ERROR: Add properties fail for " + p_target_file + " -- Property group alredy exist" + err)&lt;/PRE&gt;&lt;P&gt;I got the 500 error. Also, I'd like to say that I already delete every Template in the user to work only with one first of all, but still in the same situation.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 09:39:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407299#M22119</guid>
      <dc:creator>ADoncel</dc:creator>
      <dc:date>2020-04-06T09:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: file_properties_properties_add() - InternalServerError('', 500, '')</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407507#M22125</link>
      <description>&lt;P&gt;Thanks! It looks like there's just a small issue in that code.&amp;nbsp;The&amp;nbsp;file_properties_properties_add method expects a list of 'PropertyGroup', so instead of:&lt;/P&gt;
&lt;PRE&gt;dbx_api.file_properties_properties_add(p_target_file, property_group)&lt;/PRE&gt;
&lt;P&gt;you should do:&lt;/P&gt;
&lt;PRE&gt;dbx_api.file_properties_properties_add(p_target_file, [property_group])&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 18:54:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407507#M22125</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-06T18:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: file_properties_properties_add() - InternalServerError('', 500, '')</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407645#M22127</link>
      <description>&lt;P&gt;That was the thing I was missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 07:26:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/file-properties-properties-add-InternalServerError-500/m-p/407645#M22127</guid>
      <dc:creator>ADoncel</dc:creator>
      <dc:date>2020-04-07T07:26:39Z</dc:date>
    </item>
  </channel>
</rss>

