POST add¶
Index and add an image to your collection. This method is used to populate your image collection. Images can be uploaded directly to the server or a URL where the image is located can be specified.
Resource URL¶
https://mobileengine.tineye.com/<company>/rest/add/
Performance¶
The MobileEngine API can perform one add, update or delete request at a time. Any extra requests submitted will be queued up for processing as slots become available. Each request accepts maximum 10 images or URLs.
For maximum performance images should be pre-scaled, as described under Image Limitations below. Thus, in some cases where you could use URLs, it may be better to do the download yourself, scale the image, and send it in the request. If you are using URLs, make sure that the image comes from a low latency server as the API will need to download them before indexing.
Image limitations¶
Naming conflicts: Uploading an image with the same file path will result in an error. This method does NOT overwrite existing images.
Image size: For optimal performance, uploaded images should be 600px in size in the smallest dimension. For example, 1200x800 pixels is larger than required and it will take longer to transfer this file to your MobileEngine server. It would be faster to resize this image to be 900x600 and then send it. Images smaller than 600px may provide acceptable results, if you don’t have access to higher resolution versions. Do not scale up images.
Image content: Some images may not contain enough detail to be indexed effectively. For example, images that are extremely small or contain only a single color will not show up in search results.
Image format: Accepted formats are JPEG, PNG, WEBP, AVIF, GIF, BMP and TIFF files. Animated images are not supported.
Parameters¶
In addition to the Common parameters there are:
Image¶
Key |
Description |
---|---|
image |
An image file object that will be added to the collection. |
image_id (optional) |
An ID under which the image file will be added to the collection. Any string or integer can be used as image ID, up to 255 characters. |
filepath (optional) |
A filepath under which the image file will be added to the collection. If not supplied, the API will use the name as specified in the filename parameter of a multipart HTTP request. |
Images¶
Key |
Description |
---|---|
images[0] |
The first image file object that will be added to the collection. |
image_ids[0] (optional) |
An ID under which the first image file will be added to the collection. |
filepaths[0] (optional) |
A filepath under which the first image file will be added to the collection. |
… |
… |
images[n] (optional) |
The last image file object that will be added to the collection. |
image_ids[n] (optional) |
An ID under which the last image file will be added to the collection. |
filepaths[n] (optional) |
A filepath under which the last image file will be added to the collection. |
URL¶
Note that each url must have a filepath.
Key |
Description |
---|---|
url |
The URL of an image file that will be added to the collection. |
image_id (optional) |
An ID under which the image file will be added to the collection. Any string or integer can be used as image ID, up to 255 characters. |
filepath |
A filepath under which the image file will be added to the collection. |
URLs¶
Key |
Description |
---|---|
urls[0] |
The URL of the first image file that will be added to the collection. |
image_ids[0] (optional) |
An ID under which the first image file will be added to the collection. |
filepaths[0] |
A filepath under which the first image file will be added to the collection. |
… |
… |
urls[n] (optional) |
The URL of the last image file that will be added to the collection. |
image_ids[n] (optional) |
An ID under which the last image file will be added to the collection. |
filepaths[n] (optional) |
A filepath under which the last image file will be added to the collection. |
Request examples¶
Images¶
curl https://mobileengine.tineye.com/<company>/rest/add/ \
-F "image=@1.jpg"
or
curl https://mobileengine.tineye.com/<company>/rest/add/ \
-F "image=@1.jpg" \
-F "image_id=8ae4 ce20 88b05f" \
-F "filepath=image_1.jpg"
or
curl https://mobileengine.tineye.com/<company>/rest/add/ \
-F "images[0]=@1.jpg" \
-F "images[1]=@2.jpg" \
-F "images[2]=@3.jpg"
URLs¶
curl https://mobileengine.tineye.com/<company>/rest/add/ \
-F "url=http://example.com/1.jpg" \
-F "image_id=9658451257" \
-F "filepath=image_1.jpg"
or
curl https://mobileengine.tineye.com/<company>/rest/add/ \
-F "urls[0]=http://example.com/1.jpg" \
-F "image_ids[0]=dd8d-6dc8-bf3f" \
-F "filepaths[0]=image_1.jpg" \
-F "urls[1]=http://example.com/2.jpg" \
-F "image_ids[1]=db9561-7cecb6" \
-F "filepaths[1]=image_2.jpg"
Response examples¶
JSON¶
{
"method": "add",
"status": "ok",
"error": [],
"result": [],
"stats": {
"time_download": 40.8,
"time_resize": 91.35,
"time_add": 208.84,
"time_total": 343.95
}
}
XML¶
<?xml version="1.0" encoding="utf-8"?>
<data>
<method>add</method>
<status>ok</status>
<error/>
<result/>
<stats>
<time_download>40.8</time_download>
<time_resize>91.35</time_resize>
<time_add>208.84</time_add>
<time_total>343.95</time_total>
</stats>
</data>