Skip to main content
PUT
/
users
/
{user_id}
/
members
/
{member_id}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;

public class MDX_RealTime {
	private String BaseUrl, ClientId, ApiKey;

	public MDX_RealTime(String BaseUrl, String ClientId, String ApiKey) {
		this.BaseUrl = BaseUrl;
		this.ClientId = ClientId;
		this.ApiKey = ApiKey;
	}

	public static void main(String[] args) throws Exception {
		String base_url = "https://int-live.moneydesktop.com";
		String client_id = ":client_id";
		String api_key = ":api_key";

		MDX_RealTime mdx = new MDX_RealTime(base_url, client_id, api_key);
		
		/// Setup Member Update json object
		String user_id = "U-39XBF7";
		String member_id = "M-39XBF7";
		JSONObject member = new JSONObject();
		JSONObject fields = new JSONObject();
		fields.put("userkey", "32423DHDJDJH3947378");
		member.put("member", fields);
		
		mdx.UpdateMember(user_id, member_id, member);
	}

	public void UpdateMember(String user_id, String member_id, JSONObject member) {
		try {
			String uri = BaseUrl + "/" + ClientId + "/users/" + user_id + "/members/" + member_id + ".json";
			URL url = new URL(uri);
			
			HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
			con.setRequestMethod("PUT");
			con.setRequestProperty("Accept", "application/vnd.moneydesktop.mdx.v5+json");
			con.setRequestProperty("Content-Type", "application/vnd.moneydesktop.mdx.v5+json");
			con.setRequestProperty("MD-API-KEY", ApiKey);
			con.setDoOutput(true);

			OutputStream out = con.getOutputStream();
			out.write(member.toString().getBytes("UTF-8"));
			out.close();

			BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
			String inputLine;
			StringBuffer response = new StringBuffer();
			while ((inputLine = in.readLine()) != null) {
				response.append(inputLine);
			}
			in.close();
			con.disconnect();

			System.out.println(response.toString());
		} catch (Exception e) {
			System.out.println(e);
		}
	}
}
{
   "member": {
      "guid": "MBR-3e4f6897-06ae-e08a-29b2-27d62e574978",
      "id": "M-39XBF7",
      "metadata": null,
      "name": "Acme Bank",
      "user_guid": "USR-fe9bb059-67c4-0e6b-e8cd-3fa00b2b5735",
      "user_id": "U-39XBF7",
      "is_disabled": false
   }
}

Path Parameters

user_id
string
required
member_id
string
required

Body Parameters

id
string
is_disabled
boolean
login
string
metadata
string
name
string
password
string
userkey
string
credentials
string[]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;

public class MDX_RealTime {
	private String BaseUrl, ClientId, ApiKey;

	public MDX_RealTime(String BaseUrl, String ClientId, String ApiKey) {
		this.BaseUrl = BaseUrl;
		this.ClientId = ClientId;
		this.ApiKey = ApiKey;
	}

	public static void main(String[] args) throws Exception {
		String base_url = "https://int-live.moneydesktop.com";
		String client_id = ":client_id";
		String api_key = ":api_key";

		MDX_RealTime mdx = new MDX_RealTime(base_url, client_id, api_key);
		
		/// Setup Member Update json object
		String user_id = "U-39XBF7";
		String member_id = "M-39XBF7";
		JSONObject member = new JSONObject();
		JSONObject fields = new JSONObject();
		fields.put("userkey", "32423DHDJDJH3947378");
		member.put("member", fields);
		
		mdx.UpdateMember(user_id, member_id, member);
	}

	public void UpdateMember(String user_id, String member_id, JSONObject member) {
		try {
			String uri = BaseUrl + "/" + ClientId + "/users/" + user_id + "/members/" + member_id + ".json";
			URL url = new URL(uri);
			
			HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
			con.setRequestMethod("PUT");
			con.setRequestProperty("Accept", "application/vnd.moneydesktop.mdx.v5+json");
			con.setRequestProperty("Content-Type", "application/vnd.moneydesktop.mdx.v5+json");
			con.setRequestProperty("MD-API-KEY", ApiKey);
			con.setDoOutput(true);

			OutputStream out = con.getOutputStream();
			out.write(member.toString().getBytes("UTF-8"));
			out.close();

			BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
			String inputLine;
			StringBuffer response = new StringBuffer();
			while ((inputLine = in.readLine()) != null) {
				response.append(inputLine);
			}
			in.close();
			con.disconnect();

			System.out.println(response.toString());
		} catch (Exception e) {
			System.out.println(e);
		}
	}
}
{
   "member": {
      "guid": "MBR-3e4f6897-06ae-e08a-29b2-27d62e574978",
      "id": "M-39XBF7",
      "metadata": null,
      "name": "Acme Bank",
      "user_guid": "USR-fe9bb059-67c4-0e6b-e8cd-3fa00b2b5735",
      "user_id": "U-39XBF7",
      "is_disabled": false
   }
}