Generic Photo Tagging

This page describes API for generic photo tagging service for stock photos. The API follows the general rules of Ximilar API as described in Section First steps.

This service API has only one endpoint running at this URL:

https://api.ximilar.com/photo/tags/v2/tags

POST/v2/tags

Tagging endpoint

Quickstart

Given a list of image records, this method returns tags as predicted by the Generic Tagging services, together with probabilities (the level of certainty) for each of these tags.

Required attributes

  • Name
    records
    Type
    dict
    Description

    A batch of json records (max 10), one record is representation of an image and it's defined by _url or _base64.

Optional attributes

  • Name
    lang
    Type
    string
    Default
    Default:en
    Description

    Language settings for tags, currently: "cs", "en".

  • Name
    tagging_mode
    Type
    string
    Default
    Default:complex
    Description

    Settings of the tagging process and of returned data:

    • complex - standard tagging mode, relevance values (probabilities) are returned
    • simple - simple mode, some tags might be omitted, no probabilities returned

Returns

HTTP error code 2XX, if the method was OK and other HTTP error code, if the method failed. Body of the response is a JSON object (map) with the following fields:

  • Name
    records
    Type
    dict
    Description

    JSON array with the input records, each record enriched by field _tags containing detected tags with probabilities.

  • Name
    status
    Type
    dict
    Description

    A JSON map/dictionary with a status of the method processing. It contains these subfields: code (numeric code of the operation status; it follows the concept of HTTP status codes) and text (text describing the status code).

  • Name
    statistics
    Type
    dict
    Description

    A map of various statistics about the processing, including processing time in seconds.

Request

POST
/v2/tags
curl https://api.ximilar.com/photo/tags/v2/tags -H "Content-Type: application/json" -H "Authorization: Token __API_TOKEN__" -d '{
  "lang": "en",
  "tagging_mode": "complex",
  "records": [
    {
      "_url": "__PATH_TO_IMAGE_URL__"
    }
  ]
}'

Response

{
  "lang": "en",
  "tagging_mode": "complex",
  "status": {
    "text": "OK",
    "code": 200
  },
  "records": [
    {
      "_url": "http://example.com/myimage321.png",
      "_tags": [
        {
          "prob": 0.8912695050239563,
          "name": "indoor"
        },
        {
          "prob": 0.8378337025642395,
          "name": "room"
        }
      ],
      "_height": 500,
      "_width": 500
    }
  ],
  "statistics": {
    "processing time": 0.2893240451812744
  }
}

Was this page helpful?