"Try it out!" button works - nothing else does.
Hi, I'm trying to use someone's Swagger API. The documentation is here: https://api.streetshirts.com/swagger/ui/index#/
When I use the Swagger "Try it out!" button for creating an order everything works as expected. But when I send the same curl as the UI in terminal or from my site it sends back "{"Message":"An error has occurred."}"
I've talked to the API owner and he's said this:
"If it works in swagger then it works out end and the data is also good. It must be how your encoding it, or how you are sending the curl. As a c# developer I don’t know enough about this to help you further."
I agree with him that it should work regardless of where I sent the request from, but I can't figure it out. This is the command I sent from terminal:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-api-key: merchant_id|api_key' -d '{ \ "orderlines": [ \ { \ "qty": 1, \ "sku": "GD05|Black|S", \ "mockup_url": "exampleURL", \ "front_print_file_url": "exampleURL", \ "back_print_file_url": "", \ "designkey": "" \ } \ ], \ "partner_order_id": "Example_005", \ "address": { \ "delivery_name": "Example Name", \ "address1": "Example Address", \ "address2": "", \ "city": "London", \ "county": "", \ "postcode": "xxxxx", \ "countrycode": "GB" \ } \ }' 'https://api.streetshirts.com/orders/create'
Have I made some kind of outrageously simple mistake that I can't see?
Note the "partner_order_id" needs to be unique everytime, if you try it yourself give it a random string.
Any help or advice much appreciated.