Java for MapLarge SDK
  1. //DEFAULT CREDENTIALS
  2. String server = "<a href="http://server.maplarge.com/";
  3. String">http://server.maplarge.com/";
  4. String</a> user = "<a href="mailto:user@ml.com">user@ml.com</a>";
  5. String pass = "pw123456";
  6. int token = 123456789;
  7.  
  8. Map<String, String> params = new HashMap<String, String>();
  9.  
  10. //CREATE MAPLARGE CONNECTION WITH USER / PASSWORD
  11. MapLargeConnector mlconnPassword = new MapLargeConnector(server, user, pass);
  12.  
  13. //CREATE MAPLARGE CONNECTION WITH USER / AUTH TOKEN
  14. MapLargeConnector mlconnToken = new MapLargeConnector(server, user, token);
  15.  
  16. //CREATE TABLE SYNCHRONOUS (NO WEB CALL)
  17. params.put("account", "test");
  18. params.put("tablename", "testJavaSdkTable");
  19. params.put("fileurl", "<a href="http://localhost/testfile.csv"">http://localhost/testfile.csv"</a>);
  20. MapLargeConnector.NO_WEB_CALLS = true;
  21. String response = mlconnPassword.InvokeAPIRequest("CreateTableSynchronous", params);
  22. System.out.println(response);
  23. MapLargeConnector.NO_WEB_CALLS = false;
  24.  
  25. //RETRIEVE REMOTE USER AUTH TOKEN
  26. response = mlconnPassword.GetRemoteAuthToken(user, pass, "255.255.255.255");
  27. System.out.println(response);
  28.  
  29. //LIST GROUPS
  30. params.clear();
  31. params.put("account", "test");
  32. response = mlconnToken.InvokeAPIRequestPost("ListGroups", params);
  33. System.out.println(response);
  34.  
  35. //CREATE TABLE WITH FILES SYNCHRONOUS
  36. params.clear();
  37. params.put("account", "test");
  38. params.put("tablename", "PostedTableImport");
  39. response = mlconnToken.InvokeAPIRequestPost("CreateTableWithFilesSynchronous", params, new String[] { "C:\\temp\\usa.csv" });
  40. System.out.println(response);