How to provide apiKey in java?

Anonymous shared this question 8 months ago
Answered

I can't use your api because I don't find the way to provide the apiKey in an HttpURLConnection.

So I always get the "401" code.

What is the format to provide it?

Comments (4)

photo
1

Hello,

Did you review our Introduction to UseResponse RESTful API article?

photo
1

Hi,

yes. My problem is that I can't find the way to provide the apiKey to authenticate the request in java using an HttpURLConnection.

I also checked your PHP examples.

photo
1

You can try the following example:

URL obj = new URL("https://community.com/api/4.0/method?apiKey=xxxxx";);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
Does this way work for you?

photo
1

Yes, thank you.

photo