Update
curl --request PATCH \
--url https://{defaultHost}/v1/product_medias/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_media": {
"position": 1
}
}
'import requests
url = "https://{defaultHost}/v1/product_medias/{id}"
payload = { "product_media": { "position": 1 } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({product_media: {position: 1}})
};
fetch('https://{defaultHost}/v1/product_medias/{id}', 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://{defaultHost}/v1/product_medias/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'product_media' => [
'position' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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"
)
func main() {
url := "https://{defaultHost}/v1/product_medias/{id}"
payload := strings.NewReader("{\n \"product_media\": {\n \"position\": 1\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/product_medias/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_media\": {\n \"position\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/product_medias/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_media\": {\n \"position\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "95276530-a630-4510-921a-ba1fb8884649",
"object": "product_media",
"alt": null,
"position": 1,
"title": null,
"url": null,
"media": "fd902c02-aec1-44de-93f0-abb7d10f3001",
"product": "5dd8a806-d1e9-43a0-8a06-d543e1d1cdd9",
"created_at": 1793796938,
"updated_at": 1793796938
}Product Medias
Update
Updates a specific product media.
PATCH
/
v1
/
product_medias
/
{id}
Update
curl --request PATCH \
--url https://{defaultHost}/v1/product_medias/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_media": {
"position": 1
}
}
'import requests
url = "https://{defaultHost}/v1/product_medias/{id}"
payload = { "product_media": { "position": 1 } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({product_media: {position: 1}})
};
fetch('https://{defaultHost}/v1/product_medias/{id}', 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://{defaultHost}/v1/product_medias/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'product_media' => [
'position' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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"
)
func main() {
url := "https://{defaultHost}/v1/product_medias/{id}"
payload := strings.NewReader("{\n \"product_media\": {\n \"position\": 1\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/product_medias/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_media\": {\n \"position\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/product_medias/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_media\": {\n \"position\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "95276530-a630-4510-921a-ba1fb8884649",
"object": "product_media",
"alt": null,
"position": 1,
"title": null,
"url": null,
"media": "fd902c02-aec1-44de-93f0-abb7d10f3001",
"product": "5dd8a806-d1e9-43a0-8a06-d543e1d1cdd9",
"created_at": 1793796938,
"updated_at": 1793796938
}Authorizations
Response
200 - application/json
Success
Was this page helpful?