This endpoint allows you to view metadata profiles and validate metadata values against the profile specification. Metadata profiles include requirements for the package title and note.

Common error codes

  • 404 No Content - Package not found; returns an error object
  • 400 Bad Request - Request parameters are invalid; returns an error object
  • 500 HTTP Internal Server Error - Request is valid but the server encountered an error; returns an error object

Get Current Metadata Profiles

GET /api/metadata_profiles

This method returns a list of current metadata profiles.

Request body: None

Success response

  • 200 OK - Returned with an array of metadata profiles

Success response example

The following example response contains two metadata profiles: "Subtitles" (ID = 1) and "Transcode Prfiles" (ID = 2).

[
    {
        "id": 1,
        "name": "Subtitles",
        "created_at": "2013/09/30 00:42:39 -0500",
        "updated_at": "2017/04/18 15:14:55 -0500",
        "default": false,
        "fields": [
            {
                "id": 680,
                "name": "TV Standard",
                "type": "select",
                "choices": [
                    "NTSC",
                    "PAL",
                    "SECAM"
                ],
                "require": true
            },
            {
                "id": 681,
                "name": "Format",
                "type": "select",
                "choices": [
                    "Web",
                    "Mobile",
                    "Film",
                    "DVD",
                    "BDR",
                    "Broadcast"
                ],
                "require": true
            },
            {
                "id": 682,
                "name": "Region",
                "type": "select",
                "choices": [
                    "North America",
                    "South America",
                    "Antarctica"
                ],
                "require": false
            },
            {
                "id": 683,
                "name": "Text label",
                "type": "input",
                "illegal_chars": "",
                "max_length": "100",
                "require": false
            }
        ],
        "title": {
            "max_length": "245",
            "illegal_chars": ""
        },
        "note": {
            "max_length": "8000",
            "illegal_chars": "",
            "enabled": true
        }
    },
    {
    {
        "id": 2,
        "name": "Transcode Profiles",
        "created_at": "2014/01/22 18:21:49 -0600",
        "updated_at": "2016/10/12 00:41:30 -0500",
        "default": false,
        "fields": [
            {
                "id": 358,
                "name": "Format",
                "type": "select",
                "require": true,
                "choices": [
                    "h.264",
                    "quicktime"
                ]
            }
        ],
        "title": {
            "max_length": "245",
            "illegal_chars": ""
        },
        "note": {
            "max_length": "8000",
            "illegal_chars": "",
            "enabled": true
        }
    }
]

Get a metadata profile

GET /api/metadata_profiles/{id}

This method returns a specific metadata profile by its ID. An ID can be found in the list of metadata profiles returned by the Get current metadata profiles method. To get the metadata profile ID for a particular dropbox, the dbox_mdata_profile_id attribute will provide that information.

Request Body: None

Success Response Codes

  • HTTP 200 OK - Returned with the requested metadata profile

Success Response Example

[
   {
      "id": 2,
      "name": "Veggiedata",
      "created_at": "2016/06/15 14:30:35 -0700",
      "updated_at": "2016/06/23 14:11:03 -0700",
      "“default”": false,
      "fields": [
         {
            "id": 157,
            "name": "My favorite vegetables",
            "type": "select",
            "choices": [
               "Yes",
               "Yes"
            ],
            "require": true
         }
      ],
      "title": {
         "max_length": "100",
         "illegal_chars": ""
      },
      "note": {
         "max_length": "8000",
         "illegal_chars": "",
         "enabled": false
      }
   }
]

Get the default metadata profile

GET /api/metadata_profiles/default_profile

This method returns information about the default metadata profile for normal packages (those created with the "Create a package" method, with the endpoint /api/dropboxes/{user_id}|{dropbox_id}/packages).

Request Body: None

Success Response Codes

  • HTTP 200 OK - Returned with the requested metadata profile

Validate metadata

POST /api/metadata_profiles/{id}/validate_metadata

This method validates metadata values against a metadata specification.

Request Body: The specified metadata values

Example:

{
    "metadata_fields" : {
   	 "Protein Name": "Soy Protein Isolate",
		 "Protein Description": "High quality",
		 "Protein Type": "Soy-based",
		 "Expiration Date": "07/04/2017"
    },
	 "title":   "Send Protein Package",
	 "note":  "Domestic production"
}

Response Codes

  • HTTP 200 OK - Returned with an empty array

Example Error Response (400 Bad Request): Returned with comments in metadata fields

[
"'Protein Name' must be specified",
"Protein Type must contain one of these options: [\"Beef\", \"Chicken\", \"Fish\", \"Tofu\", \"Other\"]",
"Expiration Date must not be blank",
"Title must not contain any of the following characters: *$^"
]

Video player

Video

×