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
24

Hello,

Did you review our Introduction to UseResponse RESTful API article?

This comment is in trash! Restore
photo
21

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.

This comment is in trash! Restore
photo
44

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?

This comment is in trash! Restore
photo
18

Yes, thank you.

This comment is in trash! Restore
photo
Leave a Comment
 
Attach a file
Your vote is accepted!