Forum Discussion
Hey DrSuave ( cool name ),
So it might be the apiKey header that still has dummy data in it, the `merchat_id|api_key` part, which I guess must come from the API provider. Replace `merchat_id` and/or `api_key` with those provided by the company.
--header 'X-api-key: merchant_id|api_key'
Hopefully that helps a bit!
This doesn't appear to be an issue with the Swagger tooling, but if you feel it is, we'd recommend you look at the Open Source channels to seek help, such as https://swagger.io/support/.
PS: Please note that is an older version of https://github.com/swagger-api/swagger-ui
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.
- HKosova7 years agoSmartBear Alumni (Retired)
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
- 11 days ago
- 2 months ago