Forum Discussion
Thanks for the response - the API owner says he doesn't issue the merchant_id or api_key until a successful test run has been made using just
merchant_id|api_key
If I send the curl using
merchant_id_test|api_key
(a different string) it returns
"status":"Not Authorised","message_text":"Invalid merchant_id and api_key combination"
so it appears that the dummy test info isn't what's breaking this.
Hi DrSuave,
Are you on Windows or Mac/*nix?
If on Windows, you need to 1) write the whole command on one line; 2) enclose curl arguments in double quotes instead of single quotes; 3) escape inner quotes in JSON as \" and 4) escape | as ^| in the API key and sku.
The following works for me:
curl -k -X POST "https://api.streetshirts.com/orders/create" -H "Content-Type: application/json" -H "Accept: application/json" -H "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_123\", \"address\": {\"delivery_name\": \"Example Name\", \"address1\": \"Example Address\", \"address2\": \"\", \"city\": \"London\", \"county\": \"\", \"postcode\": \"xxxxx\", \"countrycode\": \"GB\"}}"
- DrSuave7 years agoNew Contributor
Thanks - I'm on OSx actually. I've tried loading it as a file instead of a block of text too. What did the server respond with when you sent that?
- HKosova7 years agoSmartBear Alumni (Retired)
It returns
{"status":"TEST","order_number":"903712776889","dispatch_date":"03 July 18","charge":"┬г8.95"}
and a repeated request with the same partner_order_id returns
{"status":"Bad Request","message_text":"Duplicate order"}
P.S. You can also test the requests using https://inspector.swagger.io instead of curl.
Related Content
Recent Discussions
- 24 days ago
- 2 months ago