उत्पाद प्राप्त करें, उन्हें टूल से जोड़ें और Viewer, Configurator व Customizer को एम्बेड करने के लिए सुरक्षित सेशन बनाएँ।
उदाहरणों में कनेक्शन गाइड में दिया गया सर्वर-साइड हेल्पर alterFetch और authHeaders हेडर इस्तेमाल किए गए हैं। API कुंजियाँ केवल सर्वर पर रखें।
कनेक्शन, प्राधिकरण और alterFetch हेल्पर उत्पाद एंडपॉइंट ऐसे स्टोरफ़्रंट डिज़ाइन लौटाते हैं जिन्हें viewer, configurator या customizer के रूप में एम्बेड किया जा सकता है।
पैरामीटर आवश्यक विवरण nameनहींउत्पाद/डिज़ाइन नाम से खोजता है। customizerनहींtrue या false। offsetनहींडिफ़ॉल्ट 0। मान >= 0 होना चाहिए। limitनहींडिफ़ॉल्ट 9, अधिकतम 50। order_byनहींid, name या created_at। directionनहींASC या DESC।
उदाहरण अनुरोध (fetch)
const params = new URLSearchParams ( {
limit : '20' ,
offset : '0' ,
name : 't-shirt' ,
customizer : 'true' ,
order_by : 'created_at' ,
direction : 'DESC'
} ) ;
const products = await alterFetch ( ` /products? ${ params . toString ( ) } ` ) ;
const product = await alterFetch ( '/products/381' ) ; उदाहरण जवाब
{
"products" : {
"items" : [
{
"id" : 381 ,
"name" : "Men's T-Shirt" ,
"createdAt" : "2026-01-03T23:55:05.000Z" ,
"productId" : 4 ,
"media" : {
"img" : {
"big" : "https://alterproduct.com/public-api/v1/file/public/products/4/big.png" ,
"medium" : "https://alterproduct.com/public-api/v1/file/public/products/4/medium.png" ,
"small" : "https://alterproduct.com/public-api/v1/file/public/products/4/small.png"
} ,
"mockups" : [ ]
} ,
"storefrontProduct" : {
"id" : 89 ,
"idUserDesign" : 381 ,
"shareAccess" : "public" ,
"isCustomizer" : 1
} ,
"runtimeBindings" : [
{
"id" : 42 ,
"runtimeType" : "customizer" ,
"status" : "active" ,
"externalProductId" : "wc_123"
}
] ,
"embeddable" : {
"viewer" : true ,
"configurator" : true ,
"customizer" : true
}
}
] ,
"total" : 1
}
} रनटाइम बाइंडिंग बाहरी कॉमर्स उत्पादों को Alter Product डिज़ाइन और रनटाइम प्रकारों से जोड़ती हैं। इनका उपयोग मुख्यतः WordPress/WooCommerce एकीकरण और उन्नत स्टोरफ़्रंट बैकएंड करते हैं।
पैरामीटर आवश्यक विवरण designIdनहींस्टोरफ़्रंट के स्वामित्व वाले Alter Product डिज़ाइन की ID। externalProductIdसिंक के लिए हाँबाहरी उत्पाद ID, जैसे WooCommerce उत्पाद ID। runtimeTypeसिंक के लिए हाँviewer, configurator या customizer। statusनहींdraft, active, inactive, archived या legacy_active। legacyStorefrontProductIdनहींवैकल्पिक पुरानी मैपिंग ID। legacyBindingMetaनहींवैकल्पिक JSON मेटाडेटा, जैसे manifestHash।
उदाहरण अनुरोध (fetch)
await alterFetch ( '/runtime-bindings/sync-from-wordpress' , {
method : 'POST' ,
body : JSON . stringify ( {
bindings : [
{
externalProductId : 'wc_123' ,
runtimeType : 'customizer' ,
status : 'active' ,
designId : 381 ,
legacyBindingMeta : {
manifestHash : 'a3b1...'
}
}
]
} )
} ) ;
await alterFetch ( '/runtime-bindings/42' , {
method : 'PATCH' ,
body : JSON . stringify ( {
status : 'inactive'
} )
} ) ;
await alterFetch ( '/runtime-bindings/42/activate' , { method : 'POST' } ) ;
await alterFetch ( '/runtime-bindings/42/deactivate' , { method : 'POST' } ) ; wordpress_local
await alterFetch ( '/runtime-bindings/sync-from-wordpress' , {
method : 'POST' ,
body : JSON . stringify ( {
bindings : [
{
externalProductId : 'wc_123' ,
runtimeType : 'viewer' ,
status : 'active' ,
externalDesign : {
externalDesignKey : 'wp-design-381' ,
productId : 4 ,
title : 'WooCommerce local design' ,
manifestUrl : 'https://yourstore.com/wp-content/uploads/alter/381/manifest.json' ,
assetBaseUrl : 'https://yourstore.com/wp-content/uploads/alter/381/' ,
manifestHash : 'a3b1...' ,
sourceMeta : {
pluginVersion : '1.2.0'
}
}
}
]
} )
} ) ; उदाहरण जवाब
{
"message" : "runtimeBinding.syncCompleted" ,
"runtimeBindings" : [
{
"id" : 42 ,
"designId" : 381 ,
"externalProductId" : "wc_123" ,
"runtimeType" : "customizer" ,
"status" : "active"
}
]
} अपने सर्वर पर कम अवधि वाला एम्बेड टोकन बनाएँ, iframe/रनटाइम को दें, फिर रनटाइम को Bearer टोकन से bootstrap कॉल करने दें।
पैरामीटर आवश्यक विवरण runtimeBindingIdसुझाया गयासक्रिय रनटाइम बाइंडिंग के लिए पसंदीदा पहचानकर्ता। toolruntimeBindingId न होने पर आवश्यकdesigner | viewer | configurator | customizer | model-generator toolIdtool: model-generatorस्थानीय जनरेटर प्रोजेक्ट की धनात्मक संख्यात्मक ID, उसका UUID या WooCommerce उत्पाद ID नहीं। originहाँओरिजिन जहाँ एम्बेड रेंडर होता है, जैसे https://yourstore.com. designIdएक पहचानकर्ताAlter Product डिज़ाइन ID। इसे orderId के साथ न मिलाएँ। orderIdएक पहचानकर्ताCustomizer ऑर्डर ID। केवल customizer के लिए मान्य। cartKey + cartModeनहींकेवल customizer के लिए कार्ट संदर्भ। cartMode का मान view या edit होता है।
उदाहरण अनुरोध (fetch)
const session = await alterFetch ( '/embed/session' , {
method : 'POST' ,
headers : {
'x-alter-client-fingerprint' : '9f1b7a5e4b3c2d1f9f1b7a5e4b3c2d1f'
} ,
body : JSON . stringify ( {
runtimeBindingId : 42 ,
origin : 'https://yourstore.com'
} )
} ) ;
const bootstrapResponse = await fetch ( 'https://alterproduct.com/public-api/v1/runtime/bootstrap' , {
method : 'GET' ,
headers : {
Authorization : ` Bearer ${ session . token } `
}
} ) ;
const bootstrap = await bootstrapResponse . json ( ) ;
console . log ( { session , bootstrap } ) ; नोट
await alterFetch ( '/embed/session' , {
method : 'POST' ,
body : JSON . stringify ( {
tool : 'customizer' ,
origin : 'https://yourstore.com' ,
orderId : 123
} )
} ) ;
await alterFetch ( '/embed/session' , {
method : 'POST' ,
body : JSON . stringify ( {
tool : 'viewer' ,
origin : 'https://yourstore.com' ,
designId : 381
} )
} ) ; उदाहरण जवाब
{
"token" : "eyJhbGciOiJIUzI1NiIsImtpZCI6IjEifQ..." ,
"expiresIn" : 900 ,
"kid" : "1" ,
"mode" : "design" ,
"runtimeBindingId" : 42 ,
"runtimeType" : "customizer"
} Runtime bootstrap
{
"runtimeBindingId" : 42 ,
"designId" : 381 ,
"productId" : "wc_123" ,
"runtimeType" : "customizer" ,
"storageMode" : "wordpress_local" ,
"manifestUrl" : "https://yourstore.com/wp-content/uploads/alter/381/manifest.json" ,
"assetBaseUrl" : "https://yourstore.com/wp-content/uploads/alter/381/" ,
"manifestHash" : "a3b1..." ,
"planCapabilities" : {
"viewer" : true ,
"configurator" : true ,
"customizer" : true
} ,
"cartKey" : null ,
"cartMode" : null ,
"orderId" : null
}