question

hj02 avatar image
hj02 asked Jacob Abrams commented

Best method for interacting with Clover API using Java?

I want to write a Java program that will submit get calls to the Clover API for inventory, and return the results in a user-friendly format. I'm not sure what the best method is for doing this, as I don't have a lot of experience. Can someone walk me through the process?

Edit: The program will run locally on a laptop or desktop computer. Currently I am receiving a 401 : unauthorized error any time I try to access the API. I'm not sure why. I don't think I can use OAuth since I want it to run locally. I generated an API token through my merchant settings and I set up the URL the same as in the tutorial: https://docs.clover.com/build/web-app...

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.

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Is your program running on a Clover device or on the web or on another device?

0 Likes 0 ·

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered Jacob Abrams commented

Yes if you are running code on your own machine for your own merchant then an API token is a good method of authentication. What URL are you attempting to access exactly? Did you click all the permission checkboxes next to the API token when you created it? Does curl work?

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.

hj02 avatar image hj02 commented ·

Thanks. I just got it to work. I was confused because the tutorial says to use the [Merchant ID] in the URL and in the V2 api explorer it says {mId}. On my merchant home page, there is a header that says "MID", and I have been trying to use that number to access the API. I should have been using https://www.clover.com/home/m/[STRING]. Can someone clarify the difference between the 12 digit MID number and the 13 character string in the URL on my homepage?

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Hmm I believe the MID shown on the homepage I believe is the First Data "Merchant Identification Number" used by the payment processor and printed on receipts. The merchant id in Clover URLs is a Clover specific ID. I agree it is confusing that there are two IDs.

0 Likes 0 ·

Welcome to the
Clover Developer Community