⚡Edit Product
This endpoint enables you to edit details of an existing product.
Endpoint
PUT https://api.keepup.store/v2.0/products/edit/{product_id}
Headers
Authorization: Bearer API_KEY
Body Parameters
Sample Requests
const axios = require('axios');
const productData = {
product_name: 'Product A',
description: 'High-quality gadget',
cost_price: 15.75,
selling_price: 20.00,
quantity: 50,
restock_level: 10,
show_on_storefront: 'yes',
featured_product: 'no',
category: 'Electronics',
tags: ["Electronics", "Gadget"],
variants: [{ color: "red", size: "M" }],
SKU: 'SKU12345',
barcode: '0123456789012',
product_location: 'Aisle 3, Shelf 5',
expirations: [{
batch_number: "batch123",
expiration_date: "2024-12-31",
alert_date: "2024-12-01"
}],
removed_images: [],
primary_product_image_index: 0
};
const config = {
method: 'post',
url: 'https://api.keepup.store/v2.0/products/edit/{product_id}',
headers: {
'Authorization': 'Bearer API_KEY', // Replace YOUR_ACCESS_TOKEN with your actual access token
'Content-Type': 'application/json'
},
data: JSON.stringify(productData)
};
axios(config)
.then(function (response) {
console.log('Product updated successfully:', response.data);
})
.catch(function (error) {
console.error('Failed to updated product:', error);
});
<?php
$curl = curl_init();
$filePath = '/path/to/file.jpg';
$cfile = new CURLFile($filePath, 'image/jpeg', 'file.jpg');
$postData = array(
'product_name' => 'Product A',
'description' => 'High-quality gadget',
'cost_price' => '15.75',
'selling_price' => '20.00',
'quantity' => '50',
'restock_level' => '10',
'stock_limit' => 'limited',
'show_on_storefront' => 'yes',
'featured_product' => 'no',
'category' => 'Electronics',
'tags' => json_encode(["Electronics", "Gadget"]),
'variants' => json_encode([{"color": "red", "size": "M"}]),
'SKU' => 'SKU12345',
'barcode' => '0123456789012',
'product_location' => 'Aisle 3, Shelf 5',
'expirations' => json_encode([{ "batch_number": "batch123", "expiration_date": "2024-12-31", "alert_date": "2024-12-01" }]),
'removed_images' => [],
'primary_product_image_index': 0
);
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.keepup.store/v2.0/products/edit/{product_id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $postData,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY' // Replace 'API_KEY' with your actual API key
),
));
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
}
curl_close($curl);
echo $response;
?>
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
m = MultipartEncoder(
fields={
'product_name': 'Product A',
'description': 'High-quality gadget',
'cost_price': '15.75',
'selling_price': '20.00',
'quantity': '50',
'restock_level': '10',
'stock_limit': 'limited',
'show_on_storefront': 'yes',
'featured_product': 'no',
'category': 'Electronics',
'tags': json.dumps(["Electronics", "Gadget"]),
'variants': json.dumps([{"color": "red", "size": "M"}]),
'SKU': 'SKU12345',
'barcode': '0123456789012',
'product_location': 'Aisle 3, Shelf 5',
'expirations': json.dumps([{"batch_number": "batch123", "expiration_date": "2024-12-31", "alert_date": "2024-12-01"}]),
'primary_product_image_index': '0',
'removed_image': [],
'primary_product_image_index': 0
}
)
response = requests.post('https://api.keepup.store/v2.0/products/edit/{product_id}',
data=m,
headers={'Authorization': 'Bearer API_KEY', 'Content-Type': m.content_type}) # Replace YOUR_ACCESS_TOKEN with your actual access token
print(response.text)
Sample Response
{
"status": 200,
"message": "product updated",
"data": {
"product_id": 19845
}
}
{
"status": 401,
"error": "Authentication invalid"
}
Last updated