Products
Product Endpoint
The Products API allows you to retrieve product information, including pricing, inventory levels, and metadata. You can search and filter products using various parameters.
GET/api/v1/product/
Get products by filter parameters
Name | Type | Required | Description |
---|---|---|---|
format | string | ❌ | Response format: 'json' (default) or 'xml' (BMEcat 2005 format) |
product_number | string | ❌ | Filter by single or comma-separated AXRO product numbers (e.g., 'CANL055BK' or 'CANL055BK,CANL056WH') |
oem | string | ❌ | Filter by single or comma-separated OEM numbers (e.g., '3016C002' or '3016C002,CF540A') |
ean | string | ❌ | Filter by single or comma-separated EAN numbers (e.g., '4549292124699' or '4549292124699,4549292124706') |
brand | string | ❌ | Filter by single or comma-separated brand names (e.g., 'HP,Canon,Epson') |
category | string | ❌ | Filter by single or comma-separated category IDs (e.g., '50593,50638') |
page | string | ❌ | Page number for pagination (default: 1) |
limit | string | ❌ | Number of items per page (default: 100) |
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X GET https://api.axro.com/api/v1/product/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
// Using Fetch API
fetch('https://api.axro.com/api/v1/product/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.axro.com/api/v1/product/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
$data = json_decode($response, true);
print_r($data);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/product/'
headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.axro.com/api/v1/product/"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Response Status:", resp.Status)
fmt.Println("Response Body:", string(body))
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
// Set authorization header
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
// Make the GET request
HttpResponseMessage response = await client.GetAsync("https://api.axro.com/api/v1/product/");
// Read the response
string responseBody = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
Console.WriteLine("Response: " + responseBody);
}
}
}
}
Example Response
{
"products": [
{
"product_number": "CANL055BK",
"ean": "4549292124699",
"oem_number": "3016C002",
"brand": "Canon",
"stock": 42,
"price": [
{
"from_quantity": 1,
"to_quantity": 5,
"price": 8599
},
{
"from_quantity": 6,
"to_quantity": 999999,
"price": 8299
}
],
"title": {
"en_GB": "Canon 055 Toner Cartridge - Black",
"de_DE": "Canon 055 Tonerkartusche - Schwarz"
},
"category": {
"id": 50593,
"de": "Tonerkartuschen",
"en": "Toner cartridges"
},
"modified_at": "2024-02-15T14:30:00Z"
}
],
"total_pages": 5
}
Hint
Depending on how you set the limit, you will most likely have to paginate.
Use the key total_pages
as the maximum and create a recursive function that calls the API endpoint with the next page as the page
parameter until the corresponding page is reached.
Check "Example Requests for pagination" below.
Example Request for pagination
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
#!/bin/bash
URL="https://api.axro.com/api/v1/product/"
TOKEN="YOUR_TOKEN"
CURRENT_PAGE=1
HAS_MORE_PAGES=true
while [ "$HAS_MORE_PAGES" = true ]
do
echo "Fetching page $CURRENT_PAGE..."
RESPONSE=$(curl -s -X GET "$URL?page=$CURRENT_PAGE" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json")
echo $RESPONSE | jq .
# Extract total_pages
TOTAL_PAGES=$(echo $RESPONSE | jq '.total_pages')
if [ -z "$TOTAL_PAGES" ] || [ "$TOTAL_PAGES" = "null" ]; then
echo "Could not determine total pages, stopping"
HAS_MORE_PAGES=false
elif [ $CURRENT_PAGE -ge $TOTAL_PAGES ]; then
echo "Reached last page ($TOTAL_PAGES)"
HAS_MORE_PAGES=false
else
CURRENT_PAGE=$((CURRENT_PAGE + 1))
fi
done
async function fetchAllPages() {
const url = 'https://api.axro.com/api/v1/product/';
const headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
};
let currentPage = 1;
let hasMorePages = true;
while (hasMorePages) {
try {
const response = await fetch(`${url}?page=${currentPage}`, {
method: 'GET',
headers: headers
});
const data = await response.json();
console.log(`Page ${currentPage} data:`, data);
// Check if we need to continue
if (currentPage >= data.total_pages) {
hasMorePages = false;
} else {
currentPage++;
}
} catch (error) {
console.error(`Error fetching page ${currentPage}:`, error);
hasMorePages = false; // Stop on error
}
}
}
fetchAllPages();
$url = 'https://api.axro.com/api/v1/product/';
$token = 'YOUR_TOKEN';
$headers = [
'Authorization: Bearer ' . $token,
'Content-Type: application/json'
];
$currentPage = 1;
$hasMorePages = true;
while ($hasMorePages) {
echo "Fetching page {$currentPage}...\n";
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url . '?page=' . $currentPage);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Execute the request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch) . "\n";
$hasMorePages = false;
} elseif ($httpCode != 200) {
echo "Error: HTTP status code {$httpCode}\n";
$hasMorePages = false;
} else {
// Convert JSON to associative array and print
$data = json_decode($response, true);
echo "Page {$currentPage} data:\n";
print_r($data);
// Check if we need to continue
$totalPages = isset($data['total_pages']) ? $data['total_pages'] : 0;
if ($currentPage >= $totalPages) {
echo "Reached last page ({$totalPages})\n";
$hasMorePages = false;
} else {
$currentPage++;
}
}
// Close cURL session
curl_close($ch);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/product/'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
current_page = 1
has_more_pages = True
while has_more_pages:
print(f"Fetching page {current_page}...")
response = requests.get(url, headers=headers, params={'page': current_page})
if response.status_code != 200:
print(f"Error: HTTP status code {response.status_code}")
break
data = response.json()
print(f"Page {current_page} data:")
print(data)
# Check if we need to continue
total_pages = data.get('total_pages', 0)
if current_page >= total_pages:
print(f"Reached last page ({total_pages})")
has_more_pages = False
else:
current_page += 1
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// Define a struct to hold the response structure
type ApiResponse struct {
Products []interface{} `json:"products"`
TotalPages int `json:"total_pages"`
}
func main() {
url := "https://api.axro.com/api/v1/product/"
token := "YOUR_TOKEN"
client := &http.Client{}
currentPage := 1
hasMorePages := true
for hasMorePages {
fmt.Printf("Fetching page %d...\n", currentPage)
// Create a new request
req, err := http.NewRequest("GET", fmt.Sprintf("%s?page=%d", url, currentPage), nil)
if err != nil {
fmt.Printf("Error creating request: %v\n", err)
break
}
// Add headers
req.Header.Add("Authorization", "Bearer "+token)
req.Header.Add("Content-Type", "application/json")
// Send the request
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Error sending request: %v\n", err)
break
}
// Check status code
if resp.StatusCode != http.StatusOK {
fmt.Printf("Server returned status code %d\n", resp.StatusCode)
resp.Body.Close()
break
}
// Read response body
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
fmt.Printf("Error reading response: %v\n", err)
break
}
// Parse and print JSON
var apiResponse ApiResponse
err = json.Unmarshal(body, &apiResponse)
if err != nil {
fmt.Printf("Error parsing JSON: %v\n", err)
// Print the raw response anyway
fmt.Println(string(body))
break
}
// Pretty print the JSON
prettyJSON, _ := json.MarshalIndent(apiResponse, "", " ")
fmt.Println(string(prettyJSON))
// Check if we need to continue
if currentPage >= apiResponse.TotalPages {
fmt.Printf("Reached last page (%d)\n", apiResponse.TotalPages)
hasMorePages = false
} else {
currentPage++
}
}
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
// Define a class to deserialize the API response
class ApiResponse
{
public object[] Products { get; set; }
public int TotalPages { get; set; }
}
static async Task Main()
{
string url = "https://api.axro.com/api/v1/product/";
string token = "YOUR_TOKEN";
using (HttpClient client = new HttpClient())
{
// Set up headers
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
int currentPage = 1;
bool hasMorePages = true;
while (hasMorePages)
{
try
{
Console.WriteLine($"Fetching page {currentPage}...");
// Send the request
HttpResponseMessage response = await client.GetAsync($"{url}?page={currentPage}");
response.EnsureSuccessStatusCode();
// Read and parse the response
string responseBody = await response.Content.ReadAsStringAsync();
// Print the formatted response
Console.WriteLine($"Page {currentPage} data:");
var jsonDoc = JsonDocument.Parse(responseBody);
string formatted = JsonSerializer.Serialize(jsonDoc.RootElement, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine(formatted);
// Deserialize to access total_pages
ApiResponse data = JsonSerializer.Deserialize(
responseBody,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
);
// Check if we need to continue
if (currentPage >= data.TotalPages)
{
Console.WriteLine($"Reached last page ({data.TotalPages})");
hasMorePages = false;
}
else
{
currentPage++;
}
}
catch (Exception e)
{
Console.WriteLine($"Error: {e.Message}");
hasMorePages = false;
}
}
}
}
}
Categories Endpoint
GET/api/v1/product/categories/
Get all available product categories
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X GET https://api.axro.com/api/v1/product/categories/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
// Using Fetch API
fetch('https://api.axro.com/api/v1/product/categories/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.axro.com/api/v1/product/categories/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
$data = json_decode($response, true);
print_r($data);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/product/categories/'
headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.axro.com/api/v1/product/categories/"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Response Status:", resp.Status)
fmt.Println("Response Body:", string(body))
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
// Set authorization header
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
// Make the GET request
HttpResponseMessage response = await client.GetAsync("https://api.axro.com/api/v1/product/categories/");
// Read the response
string responseBody = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
Console.WriteLine("Response: " + responseBody);
}
}
}
}
Example Response
[
{
"id": 50593,
"de": "Tonerkartuschen",
"en": "Toner cartridges"
},
{
"id": 50638,
"de": "Tintenpatronen",
"en": "Ink cartridges"
},
{
"id": 51522,
"de": "Drucker",
"en": "Printers"
}
]
Brands Endpoint
GET/api/v1/product/categories/
Get all available product brands
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X GET https://api.axro.com/api/v1/product/brands/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
// Using Fetch API
fetch('https://api.axro.com/api/v1/product/brands/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.axro.com/api/v1/product/brands/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
$data = json_decode($response, true);
print_r($data);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/product/brands/'
headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.axro.com/api/v1/product/brands/"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Response Status:", resp.Status)
fmt.Println("Response Body:", string(body))
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
// Set authorization header
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
// Make the GET request
HttpResponseMessage response = await client.GetAsync("https://api.axro.com/api/v1/product/brands/");
// Read the response
string responseBody = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
Console.WriteLine("Response: " + responseBody);
}
}
}
}
Example Response
{
"brands": [
"Canon",
"HP",
"Epson",
"Brother",
"Samsung"
]
}