API Question - unable to upload image


I am following the creating products on spreadshirt api tutorial and everything is acting as it should until I get to the “Upload the pixel design” part. Below is in python.

r = requests.put(formatted_url, data = open(‘please_work.png’, ‘rb’))

The formatted url contains the session id, time, url, method etc as a query string and works with all previous requests. I have successfully completed a post request with a similar format in order to get the design id.

The above put request gives me a 200 status code response with nothing in the text response area. Header being sent back to me shows ‘Content-Length’: ‘0’

I have tried switching the data to files, tried open().read() as a data param and many other variations.

Some variations of my attempts return:

“Sorry, the server encountered an internal error that prevent it from fulfilling this request!
Reason: The requested format is not supported by the given resource”

Even with this empty response I have continued the tutorial to the final stage, product creation with the below response(I had to format and erase some of it due to posting restrictions).

xlink:href=“https://api.spreadshirt.com/api/v1/users/xxxxxxxxx/products/1047083287” id=“1047083287”

Nothing shows up in my marketplace items or designs. I am not sure if my design was ever uploaded as I cannot find it and I am attributing this to an unsuccessful design PUT request which returns an empty status code 200 response.

Does the spreadshirt api expect the put request to have the .png in a certain format?


Api is currently available for old spreadshirt accounts before October 2016 and deprecated. The Api for newer accounts is not released or available yet :confused:

More details:

And that one:

If you nevertheless want to try, let me know, I’ll help you for sure :slight_smile:


That was the issue, thank you lovetee.