Overview

This page is aimed at developers who wish to capture when the user utilises the “Save” button that is available on some personalisation apps.

Please note that this document only applies to distributed apps that are hosted on the g3d-app.com domain. Your app may need a minor update to work with saved product state.

Specifying a Save Callback URL

The first step is to provide a URL to the personalisation app which the app can use as a landing page for when the user clicks on the save button.

The save callback URL is specified via the save parameter, i.e:

https://g3d-app.com/s/app/acp3_2/en_GB/mt217h0kr51b1wh.html#p=1007644&r=2d-canvas&guid=COMPANYREFID&save=https://example.com/save-callback&_usePs=1

Warning If your callback URL contains any special characters (such as ? or &) please ensure that it is encoded according to RFC 3986. In PHP this can be accomplished using rawurlencode().

Warning Please replace COMPANYREFID with your unique company reference ID.

Handling Callback Requests

Once the user has clicked on the “Save” button, a POST request will be made to your callback URL.

The POST request will be a standard application/x-www-form-urlencoded request that has a single field: data.

The contents of the data field will be a simple JSON encoded object, i.e:

1
2
3
4
5
6
7
8
9
10
11
{
	"ref": "0123456789ABCDEF0",
	"sku":"IP4",

	"thumbnails": [
	{
		"name": "thumbnail",
		"url": "http://g3d-app.com/u/product-state/01/23/45/67/89/0A/BC/DE/F0/thumbnails/thumbnail.png",
		"description": ""
	},
}

It is recommended that you store the value of the ref field for later use, it is required to direct the user back to their design at a later date.

It is also recommended that the thumbnail image data is copied to a location that you control as the thumbnail URL is not permanent.

Your callback URL will be opened within the same iframe that the personalisation app was running. After your callback has done any necessary processing, the iframe can be broken out using JavaScript, for example:

1
window.top.location = "http://example.com/your-page";

Loading the User’s Design

The user’s design can be subsequently reloaded by passing the value of the ref field via the ps URL parameter to a personalisation app, i.e:

http://g3d-app.com/s/app/acp3/en_GB/default.html#ps=0123456789ABCDEF0&r=2d-canvas