question

bradr avatar image
bradr asked bradr commented

401 unauthorized simple create order

Trying to do a simple create order API call using curl in sandbox.  I have created a merchant and api token.  With this curl 
C:\curl>curl -H "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXX" -H
"Content-Type: application/json" -d "{"state":"open"}" https://apisandbox.dev.cl
over.com/v3/merchants/XXXXXXXXXXXXXXXX/orders -k -v  

I am getting response of 401 unauthorized.  

Also here 
https://sandbox.dev.clover.com/api_docs/#!/orders/CreateOrder

I get a response code of 0 and no content in body.

On the token maintenance I have enabled all permissions.

What am I missing?
OrdersSandbox
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bradr avatar image
bradr answered
Got this working. We were using the wrong merchant id. Found the correct one under setup->account settings -> merchant tab
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dhanaraj avatar image
dhanaraj answered bradr commented
Try this

curl -X POST https://apisandbox.dev.clover.com/v3/merchants/XXXXXXX/orders --header "Authorization: Bearer XXXXXXXXXX" -H "Content-Type: application/json" --data '{"state": "open"}'| python -mjson.tool
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bradr avatar image bradr commented ·
Thanks for the reply. When we try this format we also still get the 401 unauthorized.

$ curl -X POST https://apisandbox.dev.clover.com/v3/merchants/RCTST00XXXXXXX/orders --header "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXX" -H "Content-Type: application/json" --data '{"state": "open"}' | python -mjson.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 47 100 30 100 17 30 17 0:00:01 --:--:-- 0:00:01 108
{
"message": "401 Unauthorized"
}
0 Likes 0 ·

Welcome to the
Clover Developer Community