Initialize

Artifi.Initialize(integrationValues)

Artifi.Initialize method is use to launch Artifi application within website page.

To integrate Artifi (Product customization tool) with your e-commerce website, you will need to call Artifi editor. Artifi editor will be called in a html div element whose "Id" you will mention in the parameter of the method.

This will open the customization screen in the specified html div element.

Request Information

Parameters

NameDescription
integrationValues

integrationValues should be the object and should contain the Artifi data, which will include the following values. This values are not case sensitive. 

productCode: 

Artifi (Product customization tool) is used to customize/design the product. The product which is to be customized will have a code or master sku.

You have to provide that code or master sku in this parameter. When Artifi will get launched, user can see/customize that product.

This parameter will represent the code of the product for which customization tool is to be called.

websiteId: 

This is the website with which product whose code is specified in "productcode" parameter is associated.

Admin user of Artifi can create one or more websites and assign products to each of the website.

The Id of the website with which customized product is associated should be specified in this parameter.

userId: 

This will be the Id of your e-commerce website's user. The user can be registered or guest.

If the user is registered, pass the user id in this parameter and if the user is not registered with your e-commerce website, create a temporary id for the user and pass that temporary id in this parameter.

The non registered user will be called as guest user.

This will be the unique user id.

divId: 

Id of html element "div" where Artifi application is to launch.

webApiclientKey: 

When any company gets registered with Artifi, Artifi will generate a special and unique key for that company which will be called as client key.

This client key will be found in registered company's profile tab in Artifi Account. 

This client key will be used for client(company) authentication and will be called as WebApiClientKey. 

isGuest [Optional]: 

User of your e-commerce website can be guest or registered user and this parameter is to determine whether the user is guest or registered.

If the user is not registered with your website, create temporary id for the user and pass that user id to "userid" parameter and that time "isGuest" parameter will be "true".

If the value is not specified, it will consider its value as "false" and treat the user as registered user.

Width [Optional]: 

Width of html element "div" whose Id is specified in "divId" parameter where Artifi application is to launch.

Height [Optional]: 

Height of html element "div" whose Id is specified in "divId" parameter where Artifi application is to launch.

designId [Optional]: 

Design id will be Id of the customized product. The product which is customized/designed using Artifi (Product customization tool) and saved or Added to cart is called as customized product.

When this customized product id is specified, It will launch the Artifi editor with the specified customized product.

This means, when Artifi editor gets open in specified html div element, you will get to see/edit the customized product whose id is specified in this parameter.

sku [Optional]: 

A product may have different variants, for example, different color or sizes. "sku" represents the code/sku of specific variant of the product.

If this parameter is specified, then whenever the Artifi will get launched, user can see/customize that product variant.

And if sku is not specified, Artifi will open the product whose code or master sku specified in parameter "productcode", ie, priority will be given to "sku". 

extraQueryString [Optional]: 

This will be the query string, which will contain some values that Artifi application will need to perform some custom functionality.

The values specified in extraQueryString parameter will be received by Artifi and Artifi can use that data to perform custom functionality.

cartQueryString [Optional]: 

Your ecommerce website will call Artifi editor which will have "Add to cart" or similar link/button which will redirect you back to your e-commerce website.

In this complete process, if you want to traverse some of the values, you can specify that values in this parameter.

For example, you have some values, which you want to keep as it is even after adding product to cart, pass those values to Initialize method in this parameter,

Artifi will not use this value and keep it safe, After clicking on "Add to cart" or similar button,

Artifi will pass this value as it is back to your e-commerce website. This will be very useful to keep some data unchanged even after adding product to cart.

On Failure

If the productCode is passed as null or not provided, then it will give message.
"Product code should not be empty or null."

If the websiteId is passed as 0 or not provided, then it will give message.
"Website Id should not be empty or null."

If the userId is passed as 0 or not provided, then it will give message.
"User Id should not be empty or null."

If the sku is passed as null or not provided, then it will give message.
"SKU should not be empty or null."

If the webApiclientKey is passed as null or not provided, then it will give message.
"Invalid webApiclientKey."

If the userId does not exist, then it will give the message.
"Invalid UserId."

If the customizedProductId is present but not belong to the given user id, then it will give the message.
"Customized Product Id / Design Id does not belong to this user."

If the productCode is present but not belong to given website id, then it will give the message.
"Product is not assigned to website."

If the customizedProductId does not exist, then it will give the message.
"Invalid  customizedProductId / DesignId."


If the websiteId does not exist, then it will give the message.
"Invalid website Id."

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.