Skip to main content

Saving private designs

The editors use a saveProduct() JavaScript method to save the personalization result.

const savingResult = await editor.saveProduct("mug");

// When the product has been saved correctly, get the promise properties.
let userId = savingResult.userId;
let stateId = savingResult.stateId;
let returnToEditUrl = savingResult.returnToEditUrl;
console.log("User " + userId + " successfully saved state " + stateId);

When you do this, a private design is created in Asset Storage. You receive its ID, which you can use to do the further operations:

  • Generate a print file
  • Insert Variable Data into the file
  • Re-open it in the editor
  • ...

Along with the private design (state) ID, you also receive URLs for the proof images and print files. If you just need to display a proof image (e.g., in a shopping cart) or download a PDF file, just use them without any additional APIs.

When working with the product model, you can serialize in to a design file by using PUT /api/atoms/v1/designs/{id}/print-product/model. This endpoint will generate a private design belonging to the user, who is working on it, and save it in that user's folder.

PUT /api/atoms/v1/designs/{id}/print-product/model
{
...
}
Was this page helpful?