फ़ाइलें, फ़ॉन्ट और मुद्राएँ
सार्वजनिक प्रीव्यू फ़ाइलें सीधे ब्राउज़र में इस्तेमाल की जा सकती हैं। सुरक्षित फ़ाइलों के लिए हस्ताक्षरित URL या files:read अनुमति वाला API क्रेडेंशियल चाहिए। फ़ॉन्ट और मुद्रा एंडपॉइंट सार्वजनिक रूप से पढ़े जा सकते हैं।
| एंडपॉइंट | ऐक्सेस | विवरण |
|---|---|---|
/file/public/products/:productId/small.png | सार्वजनिक | छोटा उत्पाद प्रीव्यू। |
/file/public/products/:productId/medium.png | सार्वजनिक | मध्यम उत्पाद प्रीव्यू। |
/file/public/products/:productId/big.png | सार्वजनिक | बड़ा उत्पाद प्रीव्यू। |
/file/protected/:key | हस्ताक्षरित URL या files:read | सुरक्षित ऑब्जेक्ट स्टोरेज फ़ाइल। |
/fonts | सार्वजनिक | फ़ॉन्ट रिकॉर्ड की ऐरे। |
/currencies | सार्वजनिक | मुद्रा रिकॉर्ड की ऐरे। |
उदाहरण अनुरोध (fetch)
const publicPreview = await fetch(
'https://alterproduct.com/public-api/v1/file/public/products/4/medium.png'
);
const protectedFile = await fetch(
'https://alterproduct.com/public-api/v1/file/protected/user_34/381/design/mockup-large.webp',
{
headers: authHeaders
}
);
const fonts = await fetch('https://alterproduct.com/public-api/v1/fonts').then((res) => res.json());
const currencies = await fetch('https://alterproduct.com/public-api/v1/currencies').then((res) => res.json());उदाहरण जवाब
[
{
"id": 1,
"family": "Inter",
"source": "google",
"category": "sans-serif",
"variants": ["regular", "600", "700"],
"subsets": ["latin"],
"version": "v19",
"menu": "Inter",
"files": {
"regular": "https://..."
}
}
][
{
"id": 1,
"code": "EUR",
"name": "Euro",
"symbol": "€",
"decimalPlaces": 2
}
]