API reference · Products
Change a product code
Changes the Code of an existing product.
https://out.stockmount.com/api/Product/SetProductCode
Works only for products in StockMount-type sources. If the new code is already used by another product in the same source, nothing is changed.
Code is at most 50 characters; longer values return 70009 (ErrorMessage: 'Code' length must be at most 50 character.).
If the product is not found, is not yours, is not in a StockMount-type source, or the code is used by another product, 99999 is returned with no ErrorMessage. A successful response has no Response.
After the change, use the new code in UpdateProduct, GetProduct and other code-based calls.
Accounts without an active Product package get error 70018; if the package cannot be verified, 99999 is returned.
Request fields
| Field | Type | Description |
|---|---|---|
ApiCode
required
|
string |
Session code returned by DoLogin.
|
ProductId
required
|
integer |
ID of the product whose code changes. A value below 1 returns 00003 (ErrorMessage: ProductId).
|
Code
required
|
string |
New product code. Max 50 characters. Empty returns 00003 (ErrorMessage: Code).
|
Response fields (Response)
On success the Response field is empty; read the outcome from Result.
Error codes for this endpoint
| Code | When |
|---|---|
70009 |
Code is longer than 50 characters. |
70018 |
Your account has no active Product package (ErrorMessage is Turkish: Ürün entegrasyonu için aktif Ürün Paketi gereklidir.). |
99999 |
An unexpected error occurred. Also returned when the product is not found, is not in a StockMount-type source, or the code is used by another product in the source (no ErrorMessage). |
For session errors (00001, 00006) and every other code see error codes.
Related endpoints
Example request
{
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
}
curl -X POST 'https://out.stockmount.com/api/Product/SetProductCode' \
-H 'Content-Type: application/json' \
-d '{
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
}'
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var json = """
{
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
}
""";
var response = await http.PostAsync(
"https://out.stockmount.com/api/Product/SetProductCode",
new StringContent(json, Encoding.UTF8, "application/json"));
var result = await response.Content.ReadAsStringAsync();
// Result == false ise ErrorCode ve ErrorMessage alanlarına bakın.
Console.WriteLine(result);
<?php
$body = <<<'JSON'
{
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
}
JSON;
$ch = curl_init('https://out.stockmount.com/api/Product/SetProductCode');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$result['Result']) {
echo $result['ErrorCode'] . ' ' . $result['ErrorMessage'];
}
import requests
payload = {
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
}
response = requests.post("https://out.stockmount.com/api/Product/SetProductCode", json=payload, timeout=60)
result = response.json()
if not result["Result"]:
print(result["ErrorCode"], result["ErrorMessage"])
const payload = {
"ApiCode": "API_CODE",
"ProductId": 987654,
"Code": "TSHIRT-001-V2"
};
const response = await fetch("https://out.stockmount.com/api/Product/SetProductCode", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const result = await response.json();
if (!result.Result) {
console.error(result.ErrorCode, result.ErrorMessage);
}
Example response
{
"Result": true
}
Try it
The request goes straight from your browser to out.stockmount.com. The ApiCode is not stored by this site; it is kept only while this tab is open.
Get an ApiCode before sending requests.
This endpoint changes real data in your account.
Recent requests
Requests sent from this tab; click one to load its body again.