Sku
Definition
- JSON
- Typescript
sku.json
{
"id": 0,
"productID": 0,
"versionID": 0,
"colorID": 0,
"skuName": "",
"qty": 0,
"price": 0,
"discount": 0,
"seq": 0,
"status": 0,
"createdAt": "",
"updatedAt": "",
}
sku.ts
export interface ISku {
id: number;
productID: number;
versionID: number;
colorID: number;
skuName: string;
qty: number;
price: number;
discount: number;
seq: number;
status: number;
createdAt: Date | null;
updatedAt: Date | null;
}
Get Skus
- Curl
- Typescript
curl -X GET "${baseUrl}/sku/?filter=${filter}&orderBy=${orderBy}&page=${page}&pageSize=${pageSize}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/sku/?filter=${filter}&orderBy=${orderBy}&page=${page}&pageSize=${pageSize}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Get Sku
- Curl
- Typescript
curl -X GET "${baseUrl}/sku/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/sku/${id}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Apply Sku.ID
- Curl
- Typescript
curl -X POST "${baseUrl}/apply/sku/id/" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/apply/sku/id/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Create Sku
- Curl
- Typescript
curl -X POST "${baseUrl}/sku/" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @sku.json
info
sku.json
{
"productID": 0,
"versionID": 0,
"colorID": 0,
"skuName": "",
"qty": 0,
"price": 0,
"discount": 0,
"seq": 0,
"status": 0,
}
tip
success status: 201
const response = await fetch("${baseUrl}/sku/", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Update Sku
- Curl
- Typescript
#!/bin/bash
curl -X PUT "${baseUrl}/sku/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @sku.json
info
sku.json
{
"productID": 0,
"versionID": 0,
"colorID": 0,
"skuName": "",
"qty": 0,
"price": 0,
"discount": 0,
"seq": 0,
"status": 0,
}
const response = await fetch("${baseUrl}/sku/${id}", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Patch Sku
- Curl
- Typescript
curl -X PATCH "${baseUrl}/sku/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Attrs: productID,versionID,colorID,skuName,qty,price,discount,seq,status" \
-d @sku.json
info
sku.json
{
"productID": 0,
"versionID": 0,
"colorID": 0,
"skuName": "",
"qty": 0,
"price": 0,
"discount": 0,
"seq": 0,
"status": 0,
}
const response = await fetch("${baseUrl}/sku/${id}", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
"Attrs": "${attrs}",
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Update Sku Status
- Curl
- Typescript
curl -X PATCH "${baseUrl}/sku/${id}/status/" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @sku.json
info
sku.json
{
"status": 0
}
const response = await fetch("${baseUrl}/sku/${id}/status/", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
body: JSON.stringify(payload),
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}
Destroy Sku
- Curl
- Typescript
curl -X DELETE "${baseUrl}/sku/${id}" \
-H "Authorization: Bearer ${accessToken}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
const response = await fetch("${baseUrl}/sku/${id}", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${accessToken}`,
},
})
const data = await response.json();
if (!response.ok) {
throw new Error(data);
}