question

tsingh avatar image
tsingh asked kishoresukumaran edited

api call to get orders

Hi, I'm a newbie and its my first time working with all this. Im trying to get orders to eventually make a little web app so I can display current orders to a monitor. I did https://api.clover.com/v3/merchants/MERCHANT ID/orders?api_key=API KEY

I use my merchant ID and i generated an API token from the website. But everytime I do this call i get {"message":"401 Unauthorized"}. Can someone please help me.

OrdersREST API
10 |2000

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

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

Are you a Clover merchant? You need to pass your token as a header,this page contains some examples of what your request should look like https://docs.clover.com/docs/making-rest-api-calls, I would recommend you read all of the child sections in the navigation on the left to get familiar with using the API.


2 comments
10 |2000

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

tsingh avatar image tsingh commented ·

Yes I am clover merchant. I tried it similar to whats on the docs and it still does not work

whatsapp-image-2022-02-28-at-55254-pm.jpeg

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ tsingh commented ·
curl --location --request GET 'https://api.clover.com/v3/merchants/{yourMerchantId' \
--header 'Authorization: Bearer YourAccessToken'

Make sure you are passing the correct merchant id - https://community.clover.com/questions/76/how-do-i-find-a-merchant-id-mid.html#:~:text=When%20you%20log%20in%20to,id%20in%20the%20page%20url.

0 Likes 0 ·
kishoresukumaran avatar image
kishoresukumaran answered kishoresukumaran edited

The below call works well like David had earlier mentioned -

curl --request GET \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {API TOKEN}'


Can you use our REST API reference documentation page which has an interactive way to craft an API call, it will just ask you the details needed and generate your API requests, you can just copy paste it? This would ensure you are not missing any elements in your api requests. I am referring to this page. Please use this page to craft your API call and copy paste it.
Also make sure you have the permissions properly set while creating the API token, if you do not have sufficient previleges, you may also again see a 401 unauthorized error.

10 |2000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community