File Transfer API Reporting
This service reports for every file sent, receive or failed as it gets done. The format of the report is shown below. The endpoint can be specified by navigating to SETTINGS -> REPORTS on the left-hand navigation pane.{ "REPORT": { "RECEIVED": { "LOG": [ { "USERIDCONTACT": "pc-svr1@binfer.com", "TIME_TAKEN_IN_SEC": "0", "FROM_IP": "38.130.73.66", "SIZE1": "1024", "SIZE2": "1024", "TO_DEVICEID": "88a7e53c-d993-3f95-9430-298f4097cddf", "FROM_DEVICEID": "a9f7e979-65d6-3f79-9a52-9102a973b8b9", "FROM_USERID": "c1", "TO_IP": "192.192.192.39", "CREATED": "1553439748", "TO_USERID": "pc-svr1@binfer.com", "SUBJECT": "c1-s", "INDEX": "834edb35-b31c-3300-a7f7-d278460f6e0d", "FILENAME": "c1-svr-09123926.txt", "BANDWIDTH": "533055.0" } ] }, "SENT": { "LOG": [ { "USERIDCONTACT": "pc-svr1@binfer.com", "TIME_TAKEN_IN_SEC": "0", "FROM_IP": "192.192.192.39", "SIZE1": "1024", "SIZE2": "1024", "TO_DEVICEID": "a9f7e979-65d6-3f79-9a52-9102a973b8b9", "FROM_DEVICEID": "88a7e53c-d993-3f95-9430-298f4097cddf", "FROM_USERID": "pc-svr1@binfer.com", "TO_IP": "38.130.73.66", "CREATED": "1553435128", "TO_USERID": "c1", "SUBJECT": "s-c1", "INDEX": "d9f3b17b-f34a-33d9-a4e8-9cae04ec064c", "FILENAME": "svr-c1-09123824.txt", "BANDWIDTH": "1672382.0" } ] }, "FAIL": { "LOG": [] } } }
All API responses are encoded as strings from their native data types. They can be converted to specific data types. The data types are as per Java data types (see: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html)
SL.NO | DATA POINTS | NATIVE DATA TYPE | DESCRIPTION |
1 | USERIDCONTACT | String | This is the admin user id. |
2 | TIME_TAKEN_IN_SEC | Long | Time taken for this transfer session. If the transfer was auto-resumed, then it would only show the time taken for the partial transfer. |
3 | FROM_IP | String | IP address of the sending device. |
4 | SIZE1 | Long | The actual data size. |
5 | SIZE2 | Long | Data transferred in this session. In the case of a resumed transfer, this may be smaller than SIZE1 |
6 | TO_DEVICEID | UUID | A universally unique id assigned to the device. |
7 | FROM_DEVICEID | UUID | A universally unique id assigned to the device. |
8 | FROM_USERID | String | This is a user id(typically email) or PC client id. |
9 | TO_IP | String | IP address of the receiving device. |
10 | CREATED | Long | The timestamp of when the transfer started. |
11 | TO_USERID | String | This is a user id(typically email) or PC client id. |
12 | SUBJECT | String | Name of the transfer |
13 | INDEX | UUID | A unique id for this transfer. An auto-resume of a previously interrupted transfer will also have the same INDEX code. |
14 | FILENAME | String | Name of the file |
15 | BANDWIDTH | Double | The net bandwidth for this transfer session. |
Sample Response Consumption
Below we have provided a sample JSP that shows how to extract the data out of the request when it hits your server. In this example we simply convert the data to a string and print it out, most use cases will want to have a JSON library to assist in extracting specific values from within the string.
<%--
Document : ESyncTestAPI
Created on : Dec 11, 2020, 2:11:14 PM
Author : Binfer Inc.
--%>
<%@page import="java.io.ByteArrayOutputStream"%>
<%@page import="java.io.OutputStream"%>
<%@page import="java.io.InputStream"%>
<%@page contentType="text/xml" pageEncoding="UTF-8"%>
<%
System.out.println("ESyncTestAPI Started\n");
try {
//Grab the input stream and create the output stream
InputStream is = request.getInputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream();
//Read from the input stream to the output stream
int n;
byte[] buffer = new byte[1024];
while((n = is.read(buffer)) > -1) {
// Don't allow any extra bytes in final write
os.write(buffer, 0, n);
}
//Convert the output stream to a string to be processed or printed
String s = new String(os.toByteArray());
System.out.println(s);
//Close and flush the streams
is.close();
os.flush();
os.close();
} catch (Exception e) {
System.out.println("Expn. ESyncTestAPI,msg:" + e.getMessage());
}
System.out.println("\nEsyncTestAPI Ended");
%>