Skip to main content

Update User

Use this endpoint to update a user. This endpoint accepts the optional MX-SKIP-WEBHOOK header.

PUT
/users/{user_id}

Request Body

FieldRequiredType

birthdate

Optional
String

credit_score

Optional
String

email

Optional
String

first_name

Optional
String

gender

Optional
String

is_disabled

Optional
String

last_name

Optional
String

metadata

Optional
String

phone

Optional
String

zip_code

Optional
String

Request sample

Language:

_65
import java.io.BufferedReader;
_65
import java.io.InputStreamReader;
_65
import java.io.OutputStream;
_65
import java.net.URL;
_65
import javax.net.ssl.HttpsURLConnection;
_65
import org.json.JSONObject;
_65
_65
public class MDX_RealTime {
_65
private String BaseUrl, ClientId, ApiKey;
_65
_65
public MDX_RealTime(String BaseUrl, String ClientId, String ApiKey) {
_65
this.BaseUrl = BaseUrl;
_65
this.ClientId = ClientId;
_65
this.ApiKey = ApiKey;
_65
}
_65
_65
public static void main(String[] args) throws Exception {
_65
String base_url = "https://int-live.moneydesktop.com";
_65
String client_id = ":client_id";
_65
String api_key = ":api_key";
_65
_65
MDX_RealTime mdx = new MDX_RealTime(base_url, client_id, api_key);
_65
_65
/// Setup User Update json object
_65
String user_id = "U-39XBF7";
_65
JSONObject user = new JSONObject();
_65
JSONObject fields = new JSONObject();
_65
fields.put("first_name", "Doug");
_65
fields.put("gender", "MALE");
_65
user.put("user", fields);
_65
_65
mdx.UpdateUser(user_id, user);
_65
}
_65
_65
public void UpdateUser(String user_id, JSONObject user) {
_65
try {
_65
String uri = BaseUrl + "/" + ClientId + "/users/" + user_id + ".json";
_65
URL url = new URL(uri);
_65
_65
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
_65
con.setRequestMethod("PUT");
_65
con.setRequestProperty("Accept", "application/vnd.moneydesktop.mdx.v5+json");
_65
con.setRequestProperty("Content-Type", "application/vnd.moneydesktop.mdx.v5+json");
_65
con.setRequestProperty("MD-API-KEY", ApiKey);
_65
con.setDoOutput(true);
_65
_65
OutputStream out = con.getOutputStream();
_65
out.write(user.toString().getBytes("UTF-8"));
_65
out.close();
_65
_65
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
_65
String inputLine;
_65
StringBuffer response = new StringBuffer();
_65
while ((inputLine = in.readLine()) != null) {
_65
response.append(inputLine);
_65
}
_65
in.close();
_65
con.disconnect();
_65
_65
System.out.println(response.toString());
_65
} catch (Exception e) {
_65
System.out.println(e);
_65
}
_65
}
_65
}

Response sample

200
Language:json

_17
{
_17
"user": {
_17
"id": "U-39XBF7",
_17
"birthdate": "1959-07-17",
_17
"gender": "MALE",
_17
"first_name": "John",
_17
"guid": "USR-c4321d57a-9ae4-1fe3-6c4e-96a84fb92b50",
_17
"last_name": "Smith",
_17
"metadata": "Additional Information",
_17
"credit_score": 718,
_17
"email": "example@example.com",
_17
"phone": "(505) 555-1234",
_17
"zip_code": "87101",
_17
"is_disabled": false,
_17
"logged_in_at": null
_17
}
_17
}