Export for On-Demand Production
This guide will walk you through how to export a Design for on-demand production using Core3D's API via HTTP requests.
The result of this guide will be a ZIP file containing 300 DPI artwork that can be used on relevant on-demand platforms (Printful, Printify, etc.).
$TOKEN
as a placeholder for your API token in the examples below.Contents
- Step 1 — Pick a Design
- Step 2 — Create an Export
- Step 3 — Check the Status
- Step 4 — Download the Result
Step 1 — Pick a Design
We'll need a design to export -- we'll use the design from the "generate a design" guide (with URI core3d:design:018d715f-b81f-79e7-a942-c9e4f3f5f1cc
).
Step 2 — Create an Export
We'll make a request to the API to create a new Export. There are a few types of exports available to you at the moment.
- The
aop
type is a preset, it will export separate PNGs for all pattern pieces of a garment and include both graphics and patterns applied to those areas. - The
dtg
type is another preset, it will export separate PNGs and include graphics only. - The
bake
type is configurable and allows you to be more explicit about what the export should include. - See the glossary and the Export API Reference for more info.
Since our example design is an all-over print, we'll use the aop
type.
- Request
- Response
$ curl -X POST https://api.core3d.io/v1/exports \-H "Authorization: Bearer $TOKEN" \-H "Content-Type: application/json" \-d '{"design": "core3d:design:018d715f-b81f-79e7-a942-c9e4f3f5f1cc","type": "aop"}'
Step 3 — Check the Status
We can poll the API using the id
or uri
from the last request until the export is complete. The status
will change from "pending" to "running", and we'll know it's done when the status
property reads "ok". If the status
reads "error", something went wrong.
- Request
- Response
# NOTE: For convenience, you can use a URI as# the identity parameter in API requests.$ curl https://api.core3d.io/v1/exports/core3d:export:018f7e9f-8b19-7edc-8916-ce7edf87ea54 \-H "Authorization: Bearer $TOKEN"
The Export is done. Let's download the result.
Step 4 — Download the Result
The result
property contains the identity information of the resulting Upload resource. We can use the id
or uri
property to request the full Upload resource and a URL to the ZIP. The contents of the ZIP are a series of 300 DPI images, one per pattern piece.
- Request
- Response
$ curl https://api.core3d.io/v1/uploads/core3d:upload:018f7e66-8c6c-7a49-bd50-c4b7fc11dd86 \-H "Authorization: Bearer $TOKEN"