Get single product attribute term
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}import requests
url = "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}', 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 => "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"menu_order": 123,
"count": 123
}{
"code": "cocart_invalid_id",
"message": "Invalid attribute or term ID provided.",
"data": {
"status": 400
}
}{
"code": "cocart_term_not_found",
"message": "Product attribute term not found.",
"data": {
"status": 404
}
}Get a Product Attribute Term by ID
Gets a single term for a specific product attribute.
GET
/
products
/
attributes
/
{attribute_id}
/
terms
/
{id}
Get single product attribute term
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}import requests
url = "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}', 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 => "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"menu_order": 123,
"count": 123
}{
"code": "cocart_invalid_id",
"message": "Invalid attribute or term ID provided.",
"data": {
"status": 400
}
}{
"code": "cocart_term_not_found",
"message": "Product attribute term not found.",
"data": {
"status": 404
}
}Path Parameters
Unique identifier for the attribute.
Unique identifier for the attribute term.
Response
Product attribute term retrieved successfully.
Unique identifier for the resource.
Term name.
An alphanumeric identifier for the resource unique to its type.
HTML description of the resource.
Menu order, used to custom sort the resource.
Number of published products for the resource.