Obtenir le Catalogue de Produits
curl --request GET \
--url https://api.oneclickdz.com/v3/gift-cards/catalog \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/gift-cards/catalog"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/gift-cards/catalog', 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.oneclickdz.com/v3/gift-cards/catalog",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <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"
"net/http"
"io"
)
func main() {
url := "https://api.oneclickdz.com/v3/gift-cards/catalog"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.oneclickdz.com/v3/gift-cards/catalog")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/gift-cards/catalog")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"totalCategories": 123,
"totalProducts": 123,
"data": {
"categories": [
{
"title": "<string>",
"products": [
{
"id": "<string>",
"title": "<string>",
"enabled": true,
"region": "<string>"
}
]
}
]
},
"meta": {
"timestamp": "<string>"
}
}Cartes cadeaux
Obtenir le Catalogue de Produits
Obtenez toutes les cartes cadeaux et produits numériques disponibles, regroupés par catégorie
GET
/
v3
/
gift-cards
/
catalog
Obtenir le Catalogue de Produits
curl --request GET \
--url https://api.oneclickdz.com/v3/gift-cards/catalog \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/gift-cards/catalog"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/gift-cards/catalog', 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.oneclickdz.com/v3/gift-cards/catalog",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <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"
"net/http"
"io"
)
func main() {
url := "https://api.oneclickdz.com/v3/gift-cards/catalog"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.oneclickdz.com/v3/gift-cards/catalog")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/gift-cards/catalog")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"totalCategories": 123,
"totalProducts": 123,
"data": {
"categories": [
{
"title": "<string>",
"products": [
{
"id": "<string>",
"title": "<string>",
"enabled": true,
"region": "<string>"
}
]
}
]
},
"meta": {
"timestamp": "<string>"
}
}Vue d’ensemble
Retourne le catalogue complet des cartes cadeaux et produits numériques organisés par catégories (Jeux, Streaming, etc.).Mettez en cache ces données pendant au moins 24 heures. Le catalogue change peu fréquemment.
Réponse
boolean
requis
Statut de la requête
integer
Nombre total de catégories dans le catalogue
integer
Nombre total de produits dans toutes les catégories
object
requis
Afficher propriétés
Afficher propriétés
array
Tableau d’objets catégorie avec produits
Afficher objet catégorie
Afficher objet catégorie
string
Nom de la catégorie (ex. “PSN”, “Game Stores”, “iTunes”)
Exemples
curl https://api.oneclickdz.com/v3/gift-cards/catalog \
-H "X-Access-Token: YOUR_API_KEY"
const response = await fetch(
"https://api.oneclickdz.com/v3/gift-cards/catalog",
{
headers: { "X-Access-Token": "YOUR_API_KEY" },
}
);
const { data } = await response.json();
// Filter enabled products
const enabledProducts = data.categories.flatMap((cat) =>
cat.products.filter((p) => p.enabled)
);
response = requests.get(
'https://api.oneclickdz.com/v3/gift-cards/catalog',
headers={'X-Access-Token': 'YOUR_API_KEY'}
)
catalog = response.json()['data']
# Filter by category
gaming = next(c for c in catalog['categories'] if c['name'] == 'Gaming Cards')
<?php
$ch = curl_init('https://api.oneclickdz.com/v3/gift-cards/catalog');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Access-Token: YOUR_API_KEY']);
$response = json_decode(curl_exec($ch), true);
$categories = $response['data']['categories'];
?>
Exemple de réponse
{
"success": true,
"totalCategories": 14,
"totalProducts": 62,
"data": {
"categories": [
{
"title": "PSN",
"products": [
{
"id": "6126393c6f57860f925a1983",
"title": "PSN Germany",
"enabled": true,
"region": "germany"
},
{
"id": "612619816f57860f9259eee3",
"title": "PSN UK",
"enabled": true,
"region": "united-kingdom"
},
{
"id": "60111eba751a26110ab5b209",
"title": "PSN US",
"enabled": true,
"region": "united-states-america"
}
]
},
{
"title": "Game Stores",
"products": [
{
"id": "6037a862b8d036107c61d312",
"title": "Steam USD",
"enabled": true,
"region": "united-states-america"
},
{
"id": "6038ffd52a60b8107c134e39",
"title": "Steam EUR",
"enabled": true,
"region": "european-union"
},
{
"id": "60b6f304ad371a16a4347e11",
"title": "Roblox",
"enabled": true
}
]
}
]
},
"meta": {
"timestamp": "2025-10-29T00:36:52.615Z"
}
}
Construction de l’interface produit
// Example: Building a category-based UI
function renderCatalog(catalog) {
return catalog.categories.map((category) => ({
categoryName: category.name,
products: category.products
.filter((p) => p.enabled)
.map((p) => ({
id: p.id,
name: p.title,
imageUrl: `/images/products/${p.id}.png`,
})),
}));
}
Stratégie de mise en cache
// Cache for 24 hours
const cache = {
data: null,
timestamp: 0,
ttl: 24 * 60 * 60 * 1000,
};
async function getCatalog() {
const now = Date.now();
if (cache.data && now - cache.timestamp < cache.ttl) {
return cache.data;
}
const response = await fetch(
"https://api.oneclickdz.com/v3/gift-cards/catalog",
{ headers: { "X-Access-Token": process.env.API_KEY } }
);
cache.data = await response.json();
cache.timestamp = now;
return cache.data;
}
from datetime import datetime, timedelta
import requests
class CatalogCache:
def __init__(self):
self.data = None
self.timestamp = None
self.ttl = timedelta(minutes=10)
def get(self):
if self.data and datetime.now() - self.timestamp < self.ttl:
return self.data
response = requests.get(
'https://api.oneclickdz.com/v3/gift-cards/catalog',
headers={'X-Access-Token': 'YOUR_API_KEY'}
)
self.data = response.json()
self.timestamp = datetime.now()
return self.data
catalog_cache = CatalogCache()
Bonnes pratiques
Mettre en cache le catalogue
Mettre en cache pendant 10+ minutes pour réduire les appels API
Filtrer les activés
Afficher uniquement les produits avec
enabled: trueVérifier la région
Filtrer par région si vous ciblez des marchés spécifiques
Organiser par catégorie
Utiliser les catégories pour une meilleure UX
Étapes suivantes
Après avoir obtenu le catalogue :1
Afficher les produits
Montrer les produits aux utilisateurs organisés par catégorie
2
Vérifier les détails du produit
Utiliser
/checkProduct/:id pour obtenir les prix et le stock3
Passer la commande
Utiliser
/placeOrder pour acheter le produit sélectionnéConnexes
Vérifier le produit
Obtenir les prix et le stock
Passer une commande
Acheter un produit
⌘I

