How to provide apiKey in java?

Answered Guest 7 years ago

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?

Replies (3)

photo
16

Hello,

Did you review our Introduction to UseResponse RESTful API article?

photo
13

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
26

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
13

Yes, thank you.

photo
Leave a Comment
 
Attach a file