Reset Search
 

 

Article

Example of curl in Java

« Go Back

Information

 
Details
For the curl command:

North America:
curl -X POST https://developers.apteligent.com/v1.0/token -u CLIENTTOKEN -d 'grant_type=password&username=EMAIL&password=PASSWORD'

Europe:

curl -X POST https://developers.eu.apteligent.com/v1.0/token -u CLIENTTOKEN -d 'grant_type=password&username=EMAIL&password=PASSWORD'

 

Is the Java equivalent:
 

import org.apache.commons.codec.binary.Base64;;

import org.apache.http.client.fluent.Form;

import org.apache.http.client.fluent.Request;

import org.apache.http.client.fluent.Response;

Response res = Request.Post(API_BASE + "/token")

.addHeader("Authorization", "Basic " + Base64.encodeBase64String(clientID.getBytes())) .bodyForm(Form.form()

.add("grant_type", "password")

.add("username", username) .

add("password", password).build())

.execute();

 
For more information on Apteligent REST API, please visit our doc page

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255