Get Product Variant
This endpoint retrieves a list of variants related to a category_id
. Use this API as main source to retrieve the newest category variant data.
Path
get
/inventory/v2/fs/:fs_id/category/get_variant?cat_id=:cat_id
Request Parameters
Parameter | Type | Required | Location | Description |
---|---|---|---|---|
fs_id | Integer | Required | path | Fulfillment service unique identifier |
cat_id | Integer | Required | path | Category unique identifier |
Example Request
- Curl
- Go
- Java
- Node.js
curl -X GET \
'https://fs.tokopedia.net/inventory/v2/fs/13004/category/get_variant?cat_id=3412' \
-H 'Authorization: Bearer HB8GNgfdRXS9c_sksTdTBw'
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://fs.tokopedia.net/inventory/v2/fs/13004/category/get_variant?cat_id=3412"
client := &http.Client {}
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
// handle err
}
req.Header.Add("Authorization", "Bearer HB8GNgfdRXS9c_sksTdTBw")
res, err := client.Do(req)
if err != nil {
// handle err
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
// handle err
}
fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://fs.tokopedia.net/inventory/v2/fs/13004/category/get_variant?cat_id=3412")
.method("GET", null)
.addHeader("Authorization", "Bearer HB8GNgfdRXS9c_sksTdTBw")
.build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'https://fs.tokopedia.net',
'path': 'inventory/v2/fs/13004/category/get_variant?cat_id=3412',
'headers': {
'Authorization': 'Bearer HB8GNgfdRXS9c_sksTdTBw'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Response Parameters
name | type | demo value | description |
---|---|---|---|
Integer | 3412 | Category Unique Identifier | |
Integer Array | [1],[29] | Variant Combinations Identifier | |
variant_details | Object Array |
Success Response Examples
{
"header": {
"process_time": 0,
"messages": "Your request has been processed successfully"
},
"data": {
"category_id": 3412,
"variant_id_combinations": [
[
1
],
[
29
]
],
"variant_details": [
{
"variant_id": 1,
"has_unit": 0,
"identifier": "colour",
"name": "Warna",
"status": 2,
"units": [
{
"variant_unit_id": 0,
"status": 1,
"unit_name": "",
"unit_short_name": "",
"unit_values": [
{
"variant_unit_value_id": 1,
"status": 1,
"value": "Putih",
"equivalent_value_id": 1,
"english_value": "White",
"hex": "#ffffff",
"icon": ""
},
{
"variant_unit_value_id": 2,
"status": 1,
"value": "Hitam",
"equivalent_value_id": 2,
"english_value": "Black",
"hex": "#000000",
"icon": ""
},
{
"variant_unit_value_id": 5,
"status": 1,
"value": "Biru",
"equivalent_value_id": 5,
"english_value": "Blue",
"hex": "#1d6cbb",
"icon": ""
},
{
"variant_unit_value_id": 6,
"status": 1,
"value": "Biru Muda",
"equivalent_value_id": 6,
"english_value": "Light Blue",
"hex": "#8ad1e8",
"icon": ""
},
{
"variant_unit_value_id": 9,
"status": 1,
"value": "Merah",
"equivalent_value_id": 9,
"english_value": "Red",
"hex": "#ff0016",
"icon": ""
},
{
"variant_unit_value_id": 11,
"status": 1,
"value": "Merah Muda",
"equivalent_value_id": 11,
"english_value": "Pink",
"hex": "#ffb0b0",
"icon": ""
},
{
"variant_unit_value_id": 12,
"status": 1,
"value": "Orange",
"equivalent_value_id": 12,
"english_value": "Orange",
"hex": "#ffa500",
"icon": ""
},
{
"variant_unit_value_id": 13,
"status": 1,
"value": "Kuning",
"equivalent_value_id": 13,
"english_value": "Yellow",
"hex": "#ffff00",
"icon": ""
},
{
"variant_unit_value_id": 16,
"status": 1,
"value": "Cokelat",
"equivalent_value_id": 16,
"english_value": "Brown",
"hex": "#8b4513",
"icon": ""
},
{
"variant_unit_value_id": 18,
"status": 1,
"value": "Hijau",
"equivalent_value_id": 18,
"english_value": "Green",
"hex": "#006400",
"icon": ""
},
{
"variant_unit_value_id": 19,
"status": 1,
"value": "Ungu",
"equivalent_value_id": 19,
"english_value": "Purple",
"hex": "#bf00ff",
"icon": ""
},
{
"variant_unit_value_id": 218,
"status": 1,
"value": "Abu-abu",
"equivalent_value_id": 218,
"english_value": "Grey",
"hex": "#5d5d5d",
"icon": ""
}
]
}
],
"is_primary": 0
},
{
"variant_id": 29,
"has_unit": 1,
"identifier": "size",
"name": "Ukuran",
"status": 1,
"units": [
{
"variant_unit_id": 27,
"status": 1,
"unit_name": "Default",
"unit_short_name": "default",
"unit_values": [
{
"variant_unit_value_id": 445,
"status": 1,
"value": "0",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 446,
"status": 1,
"value": "2",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 447,
"status": 1,
"value": "4",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 448,
"status": 1,
"value": "6",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 449,
"status": 1,
"value": "8",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 450,
"status": 1,
"value": "10",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 451,
"status": 1,
"value": "12",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 452,
"status": 1,
"value": "14",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 453,
"status": 1,
"value": "16",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 454,
"status": 1,
"value": "XS",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 455,
"status": 1,
"value": "S",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 456,
"status": 1,
"value": "M",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 457,
"status": 1,
"value": "L",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 458,
"status": 1,
"value": "XL",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 459,
"status": 1,
"value": "XXL",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
},
{
"variant_unit_value_id": 460,
"status": 1,
"value": "All Size",
"equivalent_value_id": 0,
"english_value": "",
"hex": "",
"icon": ""
}
]
}
],
"is_primary": 0
}
]
}
}
Error Response Examples
{
"header": {
"process_time": 0,
"messages": "We could not process your request due to malformed request, please check again",
"reason": "Category ID Not Found",
"error_code": "VRT_USC_002"
},
"data": null
}
Error Codes
Error Code | Error Message | Description |
---|---|---|
VRT_USC_001 | fs_id Is Not Associated With Shop ID or Warehouse ID | fs_id not assosiated, please check again |
VRT_USC_002 | Category ID Not Found | Category ID not found, please check again |
VRT_DLV_001 | fs_id cannot be empty | There is invalid request params |
VRT_DLV_002 | invalid fs_id format | There is invalid request params |
VRT_DLV_005 | invalid product_id format | There is invalid request params |
VRT_DLV_004 | Invalid cat_id formatt | There is invalid request params |