Get started guide template for implementation

Get Started Guide

In this get started guide, we will show you step by step how to set up a simple demo to do virtual try-on! All the live api calls are authenticated with the public and secret key provided in your console portal. It is your job to keep the secret key safe from public view.

For this guide, you can reference this javascript function in react for your tests:

getAuthenticationHeader(json=false) {
		var pbkdf2 = require('pbkdf2')
		let time =  parseInt(Date.now()/1000);
		var derivedKey = pbkdf2.pbkdf2Sync({**secret_key**}, time.toString(), 128, 32, 'sha256');
		derivedKey = derivedKey.toString('hex');
		if (json) {
		    return  new Headers({
		        "public_key": {**public_key**},
		        "one_time_code": derivedKey,
		        "timestamp": time,
		        'Content-Type': 'application/json',
		        Accept: 'application/json',
		    })
		} else {
		    return  new Headers({
		        "public_key": {**public_key**},
		        "one_time_code": derivedKey,
		        "timestamp": time,
		    })
		}
}

You can view authentication documentation here for more information. Documentation for all the APIs are found here.

Step 1: Upload and retrieve your garments

For our first step, we want to choose some garments we want to place onto people. Our technology separates garments into one of four categories: tops, bottoms, outerwear, allbody.

We also have the requirement that the garments are ghost mannequins (preferred garment type) and flat lays (less ideal, but can still work!). View the garment requirements here.

Lets try retrieving the garments uploaded by your account:

fetch('[<https://api.revery.ai/console/v2/>](<https://api.revery.ai/console/v1/get_filtered_products>)get_filtered_garments', {
		    method: 'GET',
        headers: getAuthenticationHeader(),
		}
)

Expected output:

{
    "garments": [],
    "success": true,
    "total_page": 1
}

If this is your first time creating an account, there should be nothing processed.

Let’s process a top and bottom for try-on. Let’s say we want to process the top and bottom shown below.