Products
Utwórz produkt
POST
/
api
/
v2
/
products
/
{shopId}
Utwórz produkt
curl --request POST \
--url https://api.itemshop.dev/api/v2/products/{shopId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Ranga VIP",
"serverId": "664f1a2b3c4d5e6f7a8b9c0e",
"price": 19.99,
"commands": [
"lp user {PLAYER} parent set vip"
],
"description": "<string>",
"shortDescription": "<string>",
"translations": {},
"images": [
"<string>"
],
"compareAtPrice": 29.99,
"sku": "<string>",
"requirements": {
"requirePlayerOnline": true,
"minecraftVersion": "<string>",
"permissions": [
"<string>"
]
},
"inventory": {
"trackQuantity": true,
"quantity": 100,
"allowBackorder": true
},
"isActive": true,
"isFeatured": true,
"sortOrder": 123,
"minQuantity": 1,
"maxQuantity": 64,
"stepQuantity": 1,
"variants": [
{
"name": "VIP 30 dni",
"price": 19.99,
"commands": [
"<string>"
],
"description": "<string>",
"image": "<string>",
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
],
"packageSuggestions": [
{
"quantity": 50,
"bonus": 5
}
],
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
'import requests
url = "https://api.itemshop.dev/api/v2/products/{shopId}"
payload = {
"name": "Ranga VIP",
"serverId": "664f1a2b3c4d5e6f7a8b9c0e",
"price": 19.99,
"commands": ["lp user {PLAYER} parent set vip"],
"description": "<string>",
"shortDescription": "<string>",
"translations": {},
"images": ["<string>"],
"compareAtPrice": 29.99,
"sku": "<string>",
"requirements": {
"requirePlayerOnline": True,
"minecraftVersion": "<string>",
"permissions": ["<string>"]
},
"inventory": {
"trackQuantity": True,
"quantity": 100,
"allowBackorder": True
},
"isActive": True,
"isFeatured": True,
"sortOrder": 123,
"minQuantity": 1,
"maxQuantity": 64,
"stepQuantity": 1,
"variants": [
{
"name": "VIP 30 dni",
"price": 19.99,
"commands": ["<string>"],
"description": "<string>",
"image": "<string>",
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
],
"packageSuggestions": [
{
"quantity": 50,
"bonus": 5
}
],
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Ranga VIP',
serverId: '664f1a2b3c4d5e6f7a8b9c0e',
price: 19.99,
commands: ['lp user {PLAYER} parent set vip'],
description: '<string>',
shortDescription: '<string>',
translations: {},
images: ['<string>'],
compareAtPrice: 29.99,
sku: '<string>',
requirements: {
requirePlayerOnline: true,
minecraftVersion: '<string>',
permissions: ['<string>']
},
inventory: {trackQuantity: true, quantity: 100, allowBackorder: true},
isActive: true,
isFeatured: true,
sortOrder: 123,
minQuantity: 1,
maxQuantity: 64,
stepQuantity: 1,
variants: [
{
name: 'VIP 30 dni',
price: 19.99,
commands: ['<string>'],
description: '<string>',
image: '<string>',
paymentMethods: [{name: 'imojeTransfer', priceOverride: 12.99}]
}
],
packageSuggestions: [{quantity: 50, bonus: 5}],
paymentMethods: [{name: 'imojeTransfer', priceOverride: 12.99}]
})
};
fetch('https://api.itemshop.dev/api/v2/products/{shopId}', 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.itemshop.dev/api/v2/products/{shopId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Ranga VIP',
'serverId' => '664f1a2b3c4d5e6f7a8b9c0e',
'price' => 19.99,
'commands' => [
'lp user {PLAYER} parent set vip'
],
'description' => '<string>',
'shortDescription' => '<string>',
'translations' => [
],
'images' => [
'<string>'
],
'compareAtPrice' => 29.99,
'sku' => '<string>',
'requirements' => [
'requirePlayerOnline' => true,
'minecraftVersion' => '<string>',
'permissions' => [
'<string>'
]
],
'inventory' => [
'trackQuantity' => true,
'quantity' => 100,
'allowBackorder' => true
],
'isActive' => true,
'isFeatured' => true,
'sortOrder' => 123,
'minQuantity' => 1,
'maxQuantity' => 64,
'stepQuantity' => 1,
'variants' => [
[
'name' => 'VIP 30 dni',
'price' => 19.99,
'commands' => [
'<string>'
],
'description' => '<string>',
'image' => '<string>',
'paymentMethods' => [
[
'name' => 'imojeTransfer',
'priceOverride' => 12.99
]
]
]
],
'packageSuggestions' => [
[
'quantity' => 50,
'bonus' => 5
]
],
'paymentMethods' => [
[
'name' => 'imojeTransfer',
'priceOverride' => 12.99
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.itemshop.dev/api/v2/products/{shopId}"
payload := strings.NewReader("{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.post("https://api.itemshop.dev/api/v2/products/{shopId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.itemshop.dev/api/v2/products/{shopId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "664f1a2b3c4d5e6f7a8b9c0d",
"name": "Ranga VIP",
"slug": "ranga-vip",
"price": 19.99,
"serverId": "664f1a2b3c4d5e6f7a8b9c0d",
"shopId": "664f1a2b3c4d5e6f7a8b9c0d",
"commands": [
"lp user {PLAYER} parent set vip"
],
"isActive": true
},
"message": "<string>"
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}Autoryzacje
apiKeyAuthbearerAuth
Parametry ścieżki
ID sklepu (ObjectId)
Treść
application/json
Nazwa produktu
Required string length:
1 - 200Przykład:
"Ranga VIP"
ID serwera (ObjectId)
Przykład:
"664f1a2b3c4d5e6f7a8b9c0e"
Cena
Wymagany zakres:
x >= 0Przykład:
19.99
Komendy do wykonania (z placeholderami)
Minimum array length:
1Przykład:
["lp user {PLAYER} parent set vip"]
Opis (HTML/markdown)
Maximum string length:
5000Krótki opis
Maximum string length:
500Tłumaczenia per język (klucz = kod ISO)
Bezpośrednie linki do zdjęć
Cena przed promocją
Wymagany zakres:
x >= 0Przykład:
29.99
SKU
Maximum string length:
100Wymagania
Show child attributes
Show child attributes
Magazyn
Show child attributes
Show child attributes
Czy aktywny
Wyróżniony
Kolejność sortowania
Tryb sprzedaży: warianty albo ilość (suwak)
Dostępne opcje:
variants, quantity Minimalna ilość (suwak)
Wymagany zakres:
x >= 1Przykład:
1
Maksymalna ilość (suwak)
Wymagany zakres:
x >= 1Przykład:
64
Krok suwaka ilości
Wymagany zakres:
x >= 1Przykład:
1
Warianty do wyboru
Show child attributes
Show child attributes
Sugestie pakietów (kafelki pod suwakiem)
Show child attributes
Show child attributes
Przypisane metody płatności
Show child attributes
Show child attributes
Czy ta strona była pomocna?
⌘I
Utwórz produkt
curl --request POST \
--url https://api.itemshop.dev/api/v2/products/{shopId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Ranga VIP",
"serverId": "664f1a2b3c4d5e6f7a8b9c0e",
"price": 19.99,
"commands": [
"lp user {PLAYER} parent set vip"
],
"description": "<string>",
"shortDescription": "<string>",
"translations": {},
"images": [
"<string>"
],
"compareAtPrice": 29.99,
"sku": "<string>",
"requirements": {
"requirePlayerOnline": true,
"minecraftVersion": "<string>",
"permissions": [
"<string>"
]
},
"inventory": {
"trackQuantity": true,
"quantity": 100,
"allowBackorder": true
},
"isActive": true,
"isFeatured": true,
"sortOrder": 123,
"minQuantity": 1,
"maxQuantity": 64,
"stepQuantity": 1,
"variants": [
{
"name": "VIP 30 dni",
"price": 19.99,
"commands": [
"<string>"
],
"description": "<string>",
"image": "<string>",
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
],
"packageSuggestions": [
{
"quantity": 50,
"bonus": 5
}
],
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
'import requests
url = "https://api.itemshop.dev/api/v2/products/{shopId}"
payload = {
"name": "Ranga VIP",
"serverId": "664f1a2b3c4d5e6f7a8b9c0e",
"price": 19.99,
"commands": ["lp user {PLAYER} parent set vip"],
"description": "<string>",
"shortDescription": "<string>",
"translations": {},
"images": ["<string>"],
"compareAtPrice": 29.99,
"sku": "<string>",
"requirements": {
"requirePlayerOnline": True,
"minecraftVersion": "<string>",
"permissions": ["<string>"]
},
"inventory": {
"trackQuantity": True,
"quantity": 100,
"allowBackorder": True
},
"isActive": True,
"isFeatured": True,
"sortOrder": 123,
"minQuantity": 1,
"maxQuantity": 64,
"stepQuantity": 1,
"variants": [
{
"name": "VIP 30 dni",
"price": 19.99,
"commands": ["<string>"],
"description": "<string>",
"image": "<string>",
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
],
"packageSuggestions": [
{
"quantity": 50,
"bonus": 5
}
],
"paymentMethods": [
{
"name": "imojeTransfer",
"priceOverride": 12.99
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Ranga VIP',
serverId: '664f1a2b3c4d5e6f7a8b9c0e',
price: 19.99,
commands: ['lp user {PLAYER} parent set vip'],
description: '<string>',
shortDescription: '<string>',
translations: {},
images: ['<string>'],
compareAtPrice: 29.99,
sku: '<string>',
requirements: {
requirePlayerOnline: true,
minecraftVersion: '<string>',
permissions: ['<string>']
},
inventory: {trackQuantity: true, quantity: 100, allowBackorder: true},
isActive: true,
isFeatured: true,
sortOrder: 123,
minQuantity: 1,
maxQuantity: 64,
stepQuantity: 1,
variants: [
{
name: 'VIP 30 dni',
price: 19.99,
commands: ['<string>'],
description: '<string>',
image: '<string>',
paymentMethods: [{name: 'imojeTransfer', priceOverride: 12.99}]
}
],
packageSuggestions: [{quantity: 50, bonus: 5}],
paymentMethods: [{name: 'imojeTransfer', priceOverride: 12.99}]
})
};
fetch('https://api.itemshop.dev/api/v2/products/{shopId}', 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.itemshop.dev/api/v2/products/{shopId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Ranga VIP',
'serverId' => '664f1a2b3c4d5e6f7a8b9c0e',
'price' => 19.99,
'commands' => [
'lp user {PLAYER} parent set vip'
],
'description' => '<string>',
'shortDescription' => '<string>',
'translations' => [
],
'images' => [
'<string>'
],
'compareAtPrice' => 29.99,
'sku' => '<string>',
'requirements' => [
'requirePlayerOnline' => true,
'minecraftVersion' => '<string>',
'permissions' => [
'<string>'
]
],
'inventory' => [
'trackQuantity' => true,
'quantity' => 100,
'allowBackorder' => true
],
'isActive' => true,
'isFeatured' => true,
'sortOrder' => 123,
'minQuantity' => 1,
'maxQuantity' => 64,
'stepQuantity' => 1,
'variants' => [
[
'name' => 'VIP 30 dni',
'price' => 19.99,
'commands' => [
'<string>'
],
'description' => '<string>',
'image' => '<string>',
'paymentMethods' => [
[
'name' => 'imojeTransfer',
'priceOverride' => 12.99
]
]
]
],
'packageSuggestions' => [
[
'quantity' => 50,
'bonus' => 5
]
],
'paymentMethods' => [
[
'name' => 'imojeTransfer',
'priceOverride' => 12.99
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.itemshop.dev/api/v2/products/{shopId}"
payload := strings.NewReader("{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.post("https://api.itemshop.dev/api/v2/products/{shopId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.itemshop.dev/api/v2/products/{shopId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Ranga VIP\",\n \"serverId\": \"664f1a2b3c4d5e6f7a8b9c0e\",\n \"price\": 19.99,\n \"commands\": [\n \"lp user {PLAYER} parent set vip\"\n ],\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"translations\": {},\n \"images\": [\n \"<string>\"\n ],\n \"compareAtPrice\": 29.99,\n \"sku\": \"<string>\",\n \"requirements\": {\n \"requirePlayerOnline\": true,\n \"minecraftVersion\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ]\n },\n \"inventory\": {\n \"trackQuantity\": true,\n \"quantity\": 100,\n \"allowBackorder\": true\n },\n \"isActive\": true,\n \"isFeatured\": true,\n \"sortOrder\": 123,\n \"minQuantity\": 1,\n \"maxQuantity\": 64,\n \"stepQuantity\": 1,\n \"variants\": [\n {\n \"name\": \"VIP 30 dni\",\n \"price\": 19.99,\n \"commands\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n }\n ],\n \"packageSuggestions\": [\n {\n \"quantity\": 50,\n \"bonus\": 5\n }\n ],\n \"paymentMethods\": [\n {\n \"name\": \"imojeTransfer\",\n \"priceOverride\": 12.99\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "664f1a2b3c4d5e6f7a8b9c0d",
"name": "Ranga VIP",
"slug": "ranga-vip",
"price": 19.99,
"serverId": "664f1a2b3c4d5e6f7a8b9c0d",
"shopId": "664f1a2b3c4d5e6f7a8b9c0d",
"commands": [
"lp user {PLAYER} parent set vip"
],
"isActive": true
},
"message": "<string>"
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}{
"success": false,
"statusCode": 400,
"error": "Komunikat błędu",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/api/v2/..."
}