Prompted by a Tweet it made sense to explore the Spreadshirt API a little bit more.
In particular it's a pitty that there was no simple way to upload a design with a commission and be able to redirect people to a product with such a design.
This project aims to provide the means to:
- Upload a design to a spreadshirt shop
- Place metadata and a commission on the design
- Publish the design in a users shop
- Provide an URL where a user can buy the design on a product like a t-shirt or a mug.
This project is intended for use with node, and relies on the fs API to read and stat files.
This project is published on npmjs.com.
Example usage is documented in src/example.ts,
which can be executed using npm start
.
It uses environment variables that can be read from .env
which should be structured like the provided .env.example
.
username
andpassword
can be obtained by registering an account in the partner area.apiKey
andapiSecret
can be obtained trough the Spreadshirt developer documentation.
example.ts
mainly performs two steps:
- It calls
sessionFetch
to create a fetch function that works similarly to node-fetch but also handles authentication as required by the API. - It calls
publishAndLink
with a fetch function and the data necessary to upload and publish a design.
The question came up whether this project has continuous support. Currently aims are:
- Dependencies should be updated from time to time.
- PRs should be reacted to in a few days.
- If something breaks an effort will be made to repair it.
- There will be no monitoring of library stability so please feel free to alert of breakages either by creating an issue or by contacting @sicarius on Twitter.
- No big effort will be made to actively increase the feature set.
- If there are PRs with new features or adjustments that's fine.
- This project is a commitment to a simple tool/package, but it is done in spare time and so may not the most exciting thing to attend to.
- Initially we tried the outdated but public SpreadShirt API Documentation.
- With this we had no luck because:
- Uploading with an image pointer is no longer supported for security reasons.
- Setting a commission in a shop context doesn't work any more.
- With this we had no luck because:
- Next we tried the current SpreadShirt T-Shirt Designer: Sketchomat.
- We also had a look at the source of zufallsshirt.de as included in the site.
- Alas a short look didn't offer a solution.
- Therefore we looked at the partner area which does solve this problem, and REd the necessary API calls.