-3

I'm making a UrlConnection and it requires a signature using SHA1. I have already generate the signature but I don't know how to append it to the connection.

Here are my codes:

String url = domain + path 
           +"?api_key="+DEVELOPER_API_KEY
           +"&timestamp="+time
           +"&username="+givenName;                        
urlToRequest = new URL(url);             
urlconnection = (HttpURLConnection)urlToRequest.openConnection();
urlconnection.setRequestMethod("POST");

I don't know where to place my signature. I've tried to append it in the url like

+"signature="+signature;


but it doesn't work. So how should I do it? Thank you guys.

1 Answers1

0

Yes, appending it to your url should work just fine, from your example however you seem to have forgot an ampersand.

url = url + "&signature=" + signature;

rorschach
  • 2,871
  • 1
  • 17
  • 20