Products – Pro Preview API

This API call uses our new patent-pending algorithm to retrieve the most realistic product previews the printing community has seen.

Getting a list of all available templates

In the Pro Preview API, you can retrieve a list of all the available templates for products that you can generate a pro preview for.

Please be sure to include the following parameters for the GET request.

    • recipeId - the recipeId for your Gooten account that is used for authetication. This can be found in the Gooten Admin.
    • partnerBillingKey - the partnerBillingKey for your Gooten acount. This can be found in the Gooten Admin.

1. Simply send a GET API request to the following URL below while substituting in the values for your SKU, recipeId and partnerBillingKey.

Each API request to the Gooten API must have the RecipeID parameter included in the URL. This is typically used to authenticate to the Gooten API. Please be sure to replace the YourRecipeID in the example with your proper RecipeID from the Gooten Admin.

You must also replace the YourPartnerBillingKey in the example with your own Partner Billing Key from the Gooten Admin.

https://previews.gooten.com/api/v/2/templates?recipeId=YourRecipeID&partnerBillingKey=YourPartnerBillingKey

Getting a list of available templates for a specific SKU

In the Pro Preview API, a Template is a name for a photo that has one-too-many printed products in it.

Please be sure to include the following parameters for the GET request.

    • SKUname - the name of the SKU that you want to fetch the template for.
    • recipeId - the recipeId for your Gooten account that is used for authetication. This can be found in the Gooten Admin.
    • partnerBillingKey - the partnerBillingKey for your Gooten acount. This can be found in the Gooten Admin.
    • strict - value is always set to true.

1. Simply send a GET API request to the following URL below while substituting in the values for your SKU, recipeId and partnerBillingKey.

Each API request to the Gooten API must have the RecipeID parameter included in the URL. This is typically used to authenticate to the Gooten API. Please be sure to replace the YourRecipeID in the example with your proper RecipeID from the Gooten Admin.

You must also replace the YourPartnerBillingKey in the example with your own Partner Billing Key from the Gooten Admin.

When you provide your partnerBillingKey, you must encode it in order for the request to work. You can use an Encoder tool to help encode your partnerBillingKey.

    https://previews.gooten.com/api/v/2/templates/for-sku/[SKUname]?recipeId=YourRecipeID&partnerBillingKey=YourPartnerBillingKey&strict=true

2. Once you’ve sent the API request, the response will display the following data.

    • style - the name for the style that the scene was photographed in.
    • name - this is a unique identifier for the template which is used later when creating new previews.
    • background - an example photo of what the template looks like
    • angle - for some products, such as mugs, multiple angles of shots are taken in a scene so that the user can see the whole product.
    • areas - a list of places in the template that a user can substitute photos into.
      • sku - the Gooten SKU.
      • width and height - the width and height of the expected photo you want to inject into this template.
      • layerId and spaceId - a unique identifier for the printed surface

You can find an example response below.

{ 
    "templates": [ 
        {
            "style": "Studio-Minimal", 
            "name": "Accent-Mug-Blue-Studio-Minimal-Right",  
            "background": "https://s3.amazonaws.com/ppml-data/data set/inpainting_results/Mug11oz-White-BlueAccent_Simple_Right.jpg", 
            "width": 2761, 
            "height": 2761, 
            "angle": "Right", 
            "areas": [ 
                { 
                    "sku": "Mug11oz-White-BlueAccent", 
                    "width": 2538, 
                    "layerId": "6C9AC", 
                    "spaceId": "C014E", 
                    "height": 945 
                } 
            ] 
        }, 
        { 
            "style": "Studio-Minimal", 
            "name": "TravelBag-Large-Studio-Minimal-Top",  
            "background": "https://s3.amazonaws.com/ppml-data/data set/inpainting_results/travelbag-3_whiteout.jpg",
            "width": 4860, 
            "height": 4860, 
            "angle": "Top", 
            "areas": [ 
                { 
                    "sku": "TravelBag-Large", 
                    "width": 2783, 
                    "layerId": "B82BCF",
                    "spaceId": "0BBFE",  
                    "height": 2036 
                }, 
                { 
                    "sku": "TravelBag-Large",
                    "width": 1321, 
                    "layerId": "22F2ED",  
                    "spaceId": "FFD03",  
                    "height": 1577 
                }, 
                { 
                    "sku": "TravelBag-Large",  
                    "width": 1321, 
                    "layerId": "522F2",  
                    "spaceId": "BDFDC",  
                    "height": 1577 
                }, 
                { 
                    "sku": "TravelBag-Large",  
                    "width": 2783, 
                    "layerId": "DB82B",  
                    "spaceId": "9E472",  
                    "height": 2036 
                } 
            ] 
        } 
    ] 
} 
Generate Pro Preview

Once you have a template from the templates endpoint, you can use the name field to generate a new preview.

1. Simply send a POST API request to the following URL below while substituting in the values for your recipeId and partnerBillingKey.

When you provide your partnerBillingKey, you must encode it in order for the request to work. You can use an Encoder tool to help encode your partnerBillingKey.

    https://previews.gooten.com/api/v/2/generate?recipeId=YourRecipeID&partnerBillingKey=YourPartnerBillingKey

2. You would then include the template which is the name field from earlier and the area with the url of your image in the body of the request.

{ 
    // name of the template 
    "template": "Accent-Mugs-Center-Angular-Black",  
    "areas": [ 
        { 
            // image with the width/height expected for the area  
            "url": "https://www.fillmurray.com/g/2538/945"  
        } 
    ] 
}

You can find an example HTTP POST request below used to create the image.

     curl -X POST \ 
    'https://previews.gooten.com/api/v/2/generate?recipeId=recipeId&partnerBillingKey=partnerBillingKey' \  
    -H 'Accept: application/json' \ 
    -H 'Cache-Control: no-cache' \ 
    -H 'Content-Type: application/json' \ 
    -d '{ 
        "template": "Accent-Mugs-Center-Angular-Black", 
        "areas": [ 
            { 
                "url": "https://www.fillmurray.com/g/2538/945" 
            } 
        ] 
    }'

3. Once you’ve sent the API request, you'll receive a response with the URL of the product preview. You can find an example response below.

{ 
    "error": false, 
    "url": "https://gtnimgmanipcdn.azureedge.net/img manip/201808152049554753399717974446819.jpg" 
} 

Generating Multi-Area Products

For generating multi-area products, you need to use the spaceId and layerId fields to identify the image placement. Both of these fields can be retrieved when you're getting the templates for the product.

1. You would submit a POST request similar to the generate pro preview step above but then also include both the spaceId and layerId in the body of the request.

You can find an example request body below used to create the image.

{ 
    "template": "TravelBag-Large-Studio-Minimal-Front",  
    "areas":[ 
        { 
            "layerId": "22F2ED", 
            "spaceId": "FFD03",  
            "url":"https://www.fillmurray.com/1321/1577"  
        }, 
        { 
            "layerId": "DB82B", 
            "spaceId": "9E472", 
            "url":"https://www.fillmurray.com/2783/2036"  
        }, 
        { 
            "layerId": "522F2", 
            "spaceId": "BDFDC", 
            "url":"https://www.fillmurray.com/2783/2036"  
        }, 
        { 
            "layerId": "B82BCF", 
            "spaceId": "0BBFE", 
            "url":"https://www.fillmurray.com/1321/1577"  
        } 
    ] 
}