Tips and FAQ

What ID Can Be Used To Get The Root Folder of Documents Hub Elements?

We are in the process of normalizing the documents hub even further, but there are always a few unique API provider differences and the 'ID' used to make a GET by the root folder ID is one such difference.

Currently the following values can be used in these elements to make GET calls directly against the root folder by ID (for example, GET /folders/{id}/contents or GET /folders/{id}/metadata).

  • Box: 0. For example GET /folders/0/contents.
  • Dropbox: Double URL-encoded path: %252F. For example, GET /folders/%252F/contents.
  • Google Drive: root.  For example, GET /folders/root/contents.
  • OneDrive: root. For example, GET /folders/root/contents.
  • ShareFile: Whatever value was input at instance provision as the Sharefile root folder, such as top. For example, GET /folders/top/contents.

How To Post Custom Fields

There is a specific order in which custom fields can be posted through API calls to files in Box. The following is an example using sample payload data that can be used as a reference when verifying the necessary API calls to make.

  1. GET /folders/content or utilize another API call to determine the file ID for an example file.
  2. GET /custom-fields/enterprise-templates

    or

    POST /custom-fields/templates  

    {
    "displayName": "Example Template",
    "fields": [
    {
    "description": "Custom Field Example",
    "displayName": "CustomField",
    "hidden": false,
    "key": "custom1",
    "type": "string"
    }
    ],
    "hidden": false,
    "scope": "enterprise",
    "templateKey": "customTemplate"
    }
    Note the template key
  3. POST /files/{id}/custom-fields/{templateKey}/templates
    {
    "scope": "enterprise"
    }
    Note: This will associate the customTemplate template with the selected file.
  4. POST /files/{id}/custom-fields
    {
    "path": "/custom1",
    "scope": "enterprise",
    "template": "customTemplate",
    "value": "Custom Field Value"
    }
    Note: this adds a custom field value to the template. The 'path' field in this POST must reference the fields.key from GET /custom-fields/enterprise-templates with a preceding forward slash.