javascriptdropbox-apidropbox-sdk-js

Dropbox API: Error when adding custom properties to a file


I'm using Dropbox SDK for Javascript and trying to add custom properties for a file:

var fetch = require('isomorphic-fetch');
new Dropbox({
    fetch: fetch,
    accessToken: '...'
})
.filePropertiesPropertiesAdd({
    path: '/wallpapers/WhatsApp Image 2018-12-31 at 20.55.09.jpeg',
    property_groups: {
        'template_id': '...',
        'fields': [
            {
                'name': 'Theme',
                'value': 'Animais'
            },
            {
                'name': 'Author',
                'value': 'Ana Flávia'
            }
        ]
    }
})
.then(this.successMeta).catch(this.errorMeta)

But I got this error:

"Error in call to API function "file_properties/properties/add": request body: property_groups: expected list, got dict"


Solution

  • Apparently they expect property_groups to be a list (an array in python) and got a dict (an object in python)

    Change the value to an array and it should work fine as per the debug message