collections

This version is deprecated, we recommend you don't use it in production.

collections

list collections items

GET /viewer/collectionsdetail/

see what you have added to the collection

Example Request

Format:
curl --request GET \
  --url 'https://dev.similar.ai:8443/viewer/collectionsdetail/?collection_id=42' \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/collectionsdetail/?collection_id=42")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/collectionsdetail/?collection_id=42",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE"
    }

conn.request("GET", "/viewer/collectionsdetail/?collection_id=42", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/collectionsdetail/?collection_id=42",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/collectionsdetail/?collection_id=42"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Query Parameters

Name Type Required Description Example
collection_id Integer Required

the id of collection

42

List collections

GET /viewer/collections/

list your collections

Example Request

Format:
curl --request GET \
  --url https://dev.similar.ai:8443/viewer/collections/ \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/collections/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/collections/",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE"
    }

conn.request("GET", "/viewer/collections/", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/collections/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/collections/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

find similar products

GET /viewer/search/

find similar products from your collection

Example Request

Format:
curl --request GET \
  --url 'https://dev.similar.ai:8443/viewer/search/?collection_id=42&product_id=42' \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/search/?collection_id=42&product_id=42")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/search/?collection_id=42&product_id=42",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE"
    }

conn.request("GET", "/viewer/search/?collection_id=42&product_id=42", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/search/?collection_id=42&product_id=42",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/search/?collection_id=42&product_id=42"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Query Parameters

Name Type Required Description Example
collection_id Integer Required 42
product_id Integer Required 42

create collection

POST /viewer/collections/

create your collection

Example Request

Format:
curl --request POST \
  --url https://dev.similar.ai:8443/viewer/collections/ \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form name=foo \
  --form tag=foo
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/collections/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\nfoo\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/collections/",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\nfoo\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\nfoo\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/viewer/collections/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/collections/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\nfoo\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/collections/"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\nfoo\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
name String Required foo
tag String Optional foo

Responses

201 Success (Empty Response)

add product to collection

POST /viewer/products/

Example Request

Format:
curl --request POST \
  --url https://dev.similar.ai:8443/viewer/products/ \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form collection=1 \
  --form custom_id=foo \
  --form sku=foo \
  --form name=foo \
  --form description=foo \
  --form url=http://google.com
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/products/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_id\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sku\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/products/",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_id\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sku\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_id\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sku\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/viewer/products/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/products/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_id\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sku\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/products/"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n1\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"custom_id\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sku\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nfoo\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
collection Integer (int32) Required 1
custom_id String Required

the item's unique id on your site

foo
sku String Required

the product sku

foo
name String Required

the product name

foo
description String Optional

product description

foo
url String (url) Required http://google.com

Responses

201 Success (Empty Response)

add image to product

POST /viewer/images/

Example Request

Format:
curl --request POST \
  --url 'https://dev.similar.ai:8443/viewer/images/?main_product_image=true' \
  --header 'accept: application/json' \
  --header 'apikey: YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form product=256 \
  --form url=http://google.com \
  --form collection=256
require 'uri'
require 'net/http'

url = URI("https://dev.similar.ai:8443/viewer/images/?main_product_image=true")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["apikey"] = 'YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"product\"\r\n\r\n256\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n256\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dev.similar.ai",
  "port": "8443",
  "path": "/viewer/images/?main_product_image=true",
  "headers": {
    "accept": "application/json",
    "apikey": "YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"product\"\r\n\r\n256\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n256\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

conn = http.client.HTTPSConnection("dev.similar.ai:8443")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"product\"\r\n\r\n256\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n256\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'apikey': "YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/viewer/images/?main_product_image=true", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8443",
  CURLOPT_URL => "https://dev.similar.ai:8443/viewer/images/?main_product_image=true",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"product\"\r\n\r\n256\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n256\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "apikey: YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://dev.similar.ai:8443/viewer/images/?main_product_image=true"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"product\"\r\n\r\n256\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttp://google.com\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection\"\r\n\r\n256\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("apikey", "YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Form Data Parameters

Name Type Required Description Example
product Integer (int32) Required 256
url String (url) Required http://google.com
collection Integer (int32) Required 256

Query Parameters

Name Type Required Description Example
main_product_image Boolean Required

if image is the main product image

true