POST/orgs/:org/datasets/:dataset/content

Add content to a dataset

Content is added to an existing dataset by sending it to this resource. Content is sent as an array of objects which contains the unique ID for the content, the URL from which it can be retrieved and optional metadata that can be used later in the Vision API for content filtering.

The maximum content body length is 1MB. There is no limit on the number of content items per request.

The ID must be a unique string within the dataset.

A dataset can have multiple content items with different IDs but the same image URL. We allow for the use case when some content doesn’t have yet a permanent image, so a default / generic one is used instead. Having the same image multiple times in a dataset will increase the chance of seeing the image multiple times when making a Vision API request.

The optimal image size for the most content is 256x256. For datasets that have fashion related content you can have better results if the minimum image size of 300x300.

The optional metadata field is a JSON object that accepts key values of the following types: string, number, boolean and simple arrays with values of type string or number. Although we don’t check that the same keys have the same type for all content in a dataset, enforcing that on your side could avoid filtering issues when using the Vision API.

Input

URL

Field Type Required Value Description
org string yes

The organisation name.

dataset string yes

The dataset name.

Body

Field Type Required Value Description
content array of objects yes

The content to add to the dataset.

content[].id string yes

The unique ID for the content. Maximum length is 255 characters.

content[].url string yes

An RFC 1738 compliant URL from which the image for the content can be retrieved. Supported image formats are jpeg, jpg and png.

content[].metadata object no

Content metadata information (category, price, quantity, availability, etc.).

Example

{
  "content": [
    {
      "id": "my-id-1",
      "url": "https://example.com/my-content-1.jpg"
    },
    {
      "id": "my-id-2",
      "url": "https://example.com/my-content-2.jpg",
      "metadata": {
        "category": "art",
        "quantity": 10,
        "price": 99.99,
        "available": true
      }
    },
    {
      "id": "my-id-3",
      "url": "https://example.com/my-content-3.jpg",
      "metadata": {
        "category": "drawings",
        "available": false
      }
    }
  ]
}

Request

curl -X POST \
     -H "Authorization: token my-org-api-token" \
     -H "Content-Type: application/json" \
     -H "Accept: application/vnd.visii.v2+json" \
     -d '{"content":[{"id":"123","url": "http://example.com/image1.jpg"},{"id":"345","url":"http://example.com/image2.jpg"}]}' \
     "https://api.visii.com/orgs/my-org/datasets/my-dataset/content"

Response

Field Type Required Value Description
status string yes

The status of the response.

HTTP/1.1 202 Accepted
{
  "status": "accepted"
}