Access Endpoint by Java

Access Endpoint of "Get Data by Barcode" which was created on example "Manage Item by Barcode by using Camera on Web Browser" by Java.

Create based on a sample code on Endpoint page

java.net.URL url = new java.net.URL("https://dbaassandbox.matsuesoft.co.jp/?????/proxyserver-AssetInfo-GetSpecificAssetByBarcode.php");    <From here, copy from Template>
javax.net.ssl.HttpsURLConnection con = (javax.net.ssl.HttpsURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setInstanceFollowRedirects(false);
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/json");
java.io.PrintWriter pw = new java.io.PrintWriter(new java.io.BufferedWriter(new java.io.OutputStreamWriter(con.getOutputStream(), "utf-8")));
pw.print("{"
		+ "\"TOKEN\": \"?????\","
		+ "\"param_AssetInfo_Barcode_where\": \"9784845623556\""             Specify Barcode to get data
		+ "}");
pw.close();

java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(con.getInputStream(), "UTF-8"));
String buffer = reader.readLine();

System.out.println(buffer);      <Until here, copy from Template>

After execute, result will be displayed as below:

{"Result":{"Barcode":"9784845623556","ItemName":"DEF Travel Book","Description":"This is DEF..."},"_status":"OK","Message":"Successfully called"}

※In case of Java, additional code is requied to encode/decode JSON. So, it doesn't handle in this sample.
※With Custom Development Option, some class will be created by development cloud such as Client Access Class and JSON data class to encode/decode JSON and store data into Java class. Supported both simple access and Async Task Loader pattern of Android's Java.

Back to top

LoginLogin with this Site's User Name (ID)
Quick Login:Quick Login by Facebook ID (Keep Login Option:ON) / Newly Register


Inquiry

© 2016-2024 Matsuesoft Corporation