Upload an Image
curl --request POST \
--url https://api.example.com/{supplierapi}/mediaimport requests
url = "https://api.example.com/{supplierapi}/media"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/{supplierapi}/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{supplierapi}/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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"
)
func main() {
url := "https://api.example.com/{supplierapi}/media"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/{supplierapi}/media")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{supplierapi}/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyVersion 1
Upload an Image
Upload a Image
Files should be uploaded using the Content-Type: multipart/form-data HTTP header. Raw data is expected.
Supported mime types are: image/jpg and image/jpeg. Maximum file size is 4Mb.
All image are resized as thumbnails to suit the system. Unless “isLogo” is true, then images will also be resized in system defined “medium” and “large” sizes. Original image will always remain.
Response
Top Level Result Object
| Field name | Nullable | Type | Description |
|---|---|---|---|
| mediaId | n | Integer | Media ID of the image. |
| supplierId | n | String | Supplier ID associated with image. |
| caption | y | String | Optional image caption. |
| path | n | String | Absolute URL path of original sized image. |
POST
/
{supplierapi}
/
media
Upload an Image
curl --request POST \
--url https://api.example.com/{supplierapi}/mediaimport requests
url = "https://api.example.com/{supplierapi}/media"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/{supplierapi}/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{supplierapi}/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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"
)
func main() {
url := "https://api.example.com/{supplierapi}/media"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/{supplierapi}/media")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{supplierapi}/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyPath Parameters
Pattern:
supplier|apiv1/supplierQuery Parameters
Raw file data. image/jpg, image/jpeg, 4Mb max
Optional caption text.
If true, smaller sizes of image provided will not be created.
Response
Returned when successful. Returns a media object.