Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 272 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to send a proper post request to WHMCS installation from android app?

#1
I am trying to send an AddClient post request to my WHMCS installation through my android app but it keeps returning "result=error;message=You did not enter your first name".

I get it to authenticate successfully but it doesnt seem to be posting the jsonObject I am sending it.

Here is a link to WHMCS api documentation:

[To see links please register here]


public void createWHMCSUser(final String emailID, final String random, final String uid) {

final String AccessUserKey = "abc123";
final String AccessKey = "abc123";
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
URL url = new URL("http://whmcs.installation.com/includes/api.php?action=AddClient&username=abc123&password=abc123&accesskey=abc123");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept","application/json");
conn.setDoOutput(true);
conn.setDoInput(true);

JSONObject jsonParam = new JSONObject();
jsonParam.put("action", "AddClient");
jsonParam.put("identifier", AccessUserKey);
jsonParam.put("secret", AccessKey);
jsonParam.put("firstname", "User");
jsonParam.put("lastname", "Name");
jsonParam.put("email", emailID);
jsonParam.put("address1", "na");
jsonParam.put("city", "na");
jsonParam.put("state", "na");
jsonParam.put("postcode", "00000");
jsonParam.put("country", "US");
jsonParam.put("phonenumber", "0000000000");
jsonParam.put("password2", random);
jsonParam.put("repsonsetype", "json");

Log.i("JSON", jsonParam.toString());
DataOutputStream os = new DataOutputStream(conn.getOutputStream());
os.writeBytes(URLEncoder.encode(jsonParam.toString(), "UTF-8"));
//os.writeBytes(jsonParam.toString());

os.flush();
os.close();

Log.i("STATUS", String.valueOf(conn.getResponseCode()));
Log.i("MSG", conn.getResponseMessage());



conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}

}
});

thread.start();

}

It should return "result=success".

But actually returns "result=error;message=You did not enter your first name".
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through