In this guide, we're going to take you through how you can fetch and search products through the Kodaris API.
Video Overview:
Example
// Login to our account
var loginRes = kd.http.fetch({
method: 'POST',
url: 'https://content.kodaris.com/api/user/customer/apiKeyLogin',
version: 2,
body: {
apiKey: 'xxxx'
},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
});
// keep our session token for future requests
var userSessionApiKey = loginRes.body.data.userSessionApiKey;
// get CRSF token for requests
var tokenRes = kd.http.fetch({
method: 'GET',
url: 'https://content.kodaris.com/api/user/customer/authToken',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey
}
});
// keep our token for future requests
var token = tokenRes.body.data;
// search products
var searchRes = kd.http.fetch({
method: 'GET',
url: 'https://content.kodaris.com/api/user/search/product/text',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey,
'X-CSRF-TOKEN': token
},
queryParams: {
"searchString": "ceilings",
"from": 1,
"facets": "fg_Edge|fg_Edge_fineline"
}
});
kd.log('searchRes', searchRes);
-> response ->
{
"status" : 200,
"errors" : null,
"body" : {
"code" : 200,
"success" : true,
"errors" : { },
"messages" : { },
"data" : {
"size" : 24,
"number" : 1,
"totalElements" : 11,
"isLast" : true,
"totalPages" : 1,
"isFirst" : true,
"hasPrevious" : false,
"hasNext" : false,
"numberOfElements" : 11,
"offset" : null,
"content" : {
"0" : {
"productID" : 7096,
"code" : "114CEMENT",
"seoCode" : "114CEMENT",
"name" : "9/16 in x 15/16 in x 12 ft USG Donn Brand Fineline 1/8 DXFF Wall Angle - M9",
"description" : " This unique, economical and simply installed system provides a monolithic ceiling look with every benefit of a standard exposed grid. The Donn® Brand Fineline® 1/8 DXFF™ Acoustical Suspension System allows for easy ceiling access, while its narrow slotted profile hides the suspension system behind acoustical panels, yielding a smooth, clean ceiling plane with minimal exposed metal. Applications All interior general-use areas Details Color: Flat White Material Type: Hot-Dipped Galvanized Steel ",
"unitStock" : null,
"smallImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/SM-USG_M9.jpg",
"mediumImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/MD-USG_M9.jpg",
"largeImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/LG-USG_M9.jpg",
"unitSell" : null,
"unitPrice" : 0,
"unitPriceConversionFactor" : null,
"unitContainer" : null,
"priceCalculationType" : null,
"url" : "https://content.kodaris.com/product/114CEMENT",
"manufacturerCode" : null,
"manufacturerProductCode" : null,
"displayFootageCalculator" : false,
"directShipped" : false,
"productType" : null
},
"1" : {
"productID" : 6782,
"code" : "AXL7540",
"seoCode" : "AXL7540",
"name" : "1 25/32 in x 10 ft USG Donn Brand Fineline 1/8 DXFF 9/16 in Acoustical Suspension System Intermediate Duty Main Tee - DXFF2930",
"description" : " This unique, economical and simply installed system provides a monolithic ceiling look with every benefit of a standard exposed grid. The Donn® Brand Fineline® 1/8 DXFF™ Acoustical Suspension System allows for easy ceiling access, while its narrow slotted profile hides the suspension system behind acoustical panels, yielding a smooth, clean ceiling plane with minimal exposed metal. Applications All interior general-use areas Details Color: Flat White Material Type: Hot-Dipped Galvanized Steel Features Narrow-profile, slotted grid system with 1/8\" reveal provides streamlined appearance Reveal accommodates partition attachments and pendant-mounted light fixtures Mitered intersections offer a clean, tailored appearance Meets or exceeds all national code requirements,including seismic Optional integrated air diffuser Accepts metal ceiling panels for ceiling-area accents without changing grid system Custom color available ICC-ES evaluated approach to seismic design installations (ICC-ESR-1222) Standard components available in Imperial and Metric sizes Available with High Recycled Content (HRC) ",
"unitStock" : null,
"smallImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/SM-USG_DXFF2930.jpg",
"mediumImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/MD-USG_DXFF2930.jpg",
"largeImage" : "https://s3.amazonaws.com/commerce.kodaris.com/product/LG-USG_DXFF2930.jpg",
"unitSell" : null,
"unitPrice" : 266.4599914550781,
"unitPriceConversionFactor" : null,
"unitContainer" : null,
"priceCalculationType" : null,
"url" : "https://content.kodaris.com/product/AXL7540",
"manufacturerCode" : null,
"manufacturerProductCode" : "DXFF2930",
"displayFootageCalculator" : false,
"directShipped" : false,
"productType" : null
}
... omitted for brevity
},
"filters" : {
"0" : {
"code" : "facets",
"name" : "Acoustical Edge",
"value" : "fg_Edge",
"attributes" : {
"0" : {
"name" : "Fineline",
"count" : 11,
"active" : true,
"value" : "fg_Edge|fg_Edge_fineline",
"categoryOrder" : 0
},
"1" : {
"name" : "Fineline Bevel",
"count" : 7,
"active" : false,
"value" : "fg_Edge|fg_Edge_finelineBevel",
"categoryOrder" : 0
},
"2" : {
"name" : "Reveal Panel",
"count" : 2,
"active" : false,
"value" : "fg_Edge|fg_Edge_revealpanel",
"categoryOrder" : 0
},
"3" : {
"name" : "Shadowline",
"count" : 8,
"active" : false,
"value" : "fg_Edge|fg_Edge_shadowline",
"categoryOrder" : 0
},
... omitted for brevity