Two API Patterns
The app uses legacy Apache HttpClient classes and modern Retrofit services. Legacy classes follow the pattern ConnectToDataBaseServer*, while MVP modules use Retrofit interfaces.
Shipedge Warehouse Pro Android app communicates with the Shipedge server using RESTful APIs. The app uses two different approaches for API calls: legacy HTTP client (Apache HttpClient) and modern Retrofit (for MVP modules). This guide documents all API endpoints, request formats, and response structures used in the app.
Understanding the API structure helps developers:
The app uses legacy Apache HttpClient classes and modern Retrofit services. Legacy classes follow the pattern ConnectToDataBaseServer*, while MVP modules use Retrofit interfaces.
All endpoints follow the pattern: https://{warehouse}.shipedge.com/android/{endpoint}.php. The warehouse identifier comes from user login.
All API responses return JSON arrays or objects. Error handling checks for “Message” fields with “error” or “success” values.
Most endpoints require authentication via token header or user credentials. Token is obtained during login and stored in the Users class.
All API endpoints use this base URL pattern:
https://{warehouse}.shipedge.com/android/{endpoint}.phpComponents:
{warehouse}: Warehouse identifier (e.g., “nc2”, “riley”, “dev”). Set during login and stored in Users.warehouse{endpoint}: Specific PHP endpoint file name (e.g., “login_last”, “pickandpack1.15.0”, “replenishment1.12.0”)Helper Method:
public static String getEndpoint(String warehouse){ return _url.concat(warehouse).concat(_endpoint); }Most features use Apache HttpClient with ConnectToDataBaseServer* classes:
Example Class: ConnectToDataBaseServerReplenishment.java
public ConnectToDataBaseServerReplenishment(String uomBarcode) { // TODO Auto-generated constructor stub this.uomBarcode = uomBarcode; }
public Replenishment [] getRepleUomBarcode() { InputStream is = null; StringBuilder sb = null; String result = null; ArrayList<NameValuePair>nameValuePairs=new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("TYPE", "Get_reple_uom")); nameValuePairs.add(new BasicNameValuePair("uomBarcode", uomBarcode)); wh = "https://"+Users.warehouse+".shipedge.com/android/replenishment1.12.0.php";Characteristics:
HttpPost with UrlEncodedFormEntityapplication/x-www-form-urlencodedNameValuePair listMVP modules (Cycle Count, Load & Move) use Retrofit:
Example Interface: CycleCountService.java
public interface CycleCountService { @POST("confirmation1.2.0.php") Call<InitCycleCountResponse> getInitZeroBins(@Body GetCycleCountParams params, @Header("token") String token);
@POST("confirmation1.2.0.php") Call<CycleCountResponse> getZeroBins(@Body GetCycleCountParams params, @Header("token") String token);
@POST("confirmation1.2.0.php") Call<HttpResponse> deleteBin(@Body CycleCountParams params, @Header("token") String token);
@POST("confirmation1.2.0.php") Call<HttpResponse> doneBin(@Body CycleCountParams params, @Header("token") String token);
@POST("confirmation1.2.0.php") Call<CycleCountResponse> doneBins(@Body GetCycleCountParams params, @Header("token") String token);
@POST("confirmation1.3.0.php") Call<HttpResponse> recountBin(@Body CycleCountRecountParams params, @Header("token") String token);}Characteristics:
@POST, @Body, @Header)application/json (automatic)enqueue)Some legacy classes use AsyncTask for background execution:
Example Class: ConnectToDataBaseServerLoginAsync.java
public class ConnectToDataBaseServerLoginAsync extends AsyncTask<String, String, String> { String message; String dataToSend; Users user[]; String[] listApp; String userName; String password; String token; String userId; public String warehouse; String keyWh; String deviceId; String opt; int userID; String listActivity = "Wall,Inventory control,Pick and pack,Quality control,Cycle count,Blind count,Returns,Replenishments,Labels out verify,Label ready,Transfers(Torch), Project Clock, Lpn, Load and move"; int CONNECTION_TIMEOUT = 3000; int READ_TIMEOUT = 20000; public static int swTimeOutConnection = 0; Context context; HttpsURLConnection conn; URL url = null; public String result = "Error"; public static String statusConnection = "free"; /********************NUEVO LOGIN**********************************************/ public ConnectToDataBaseServerLoginAsync(String dataToSend, String opt){ System.out.println("Slim "+ dataToSend);
this.message = "Error1"; this.opt = opt; this.dataToSend = dataToSend; this.warehouse="https://"+Users.warehouse+".shipedge.com/android/login_last.php"; //this.warehouse="https://"+Users.warehouse+".shipedge.com/apiv2/pro-v1/verify_credentials"; }Characteristics:
HttpsURLConnection directlyapplication/json (for modern endpoints)AsyncTaskonPostExecuteEndpoint: /android/login_last.php
Class: ConnectToDataBaseServerLoginAsync.java
Method: POST
Content-Type: application/json
Request Body (JSON):
{ "token": "user_token", "warehouse": "warehouse_id", "deviceId": "device_serial"}Response (JSON Array):
[ { "Message": "success", "UserID": "12345", "UserName": "John Doe", "Activity": "Replenishments,Pick and pack,Cycle count", "Recount": "1", "PickRoute": "1" }]Error Responses:
"errorPass" - Invalid password"errorKeyWh" - Invalid warehouse key"noActived" - Device not activated"With_out_activities" - User has no assigned activitiesUsage:
public ConnectToDataBaseServerLoginAsync(String dataToSend, String opt){ System.out.println("Slim "+ dataToSend);
this.message = "Error1"; this.opt = opt; this.dataToSend = dataToSend; this.warehouse="https://"+Users.warehouse+".shipedge.com/android/login_last.php"; //this.warehouse="https://"+Users.warehouse+".shipedge.com/apiv2/pro-v1/verify_credentials"; }Endpoint: /android/login1.2.0.php
Class: ConnecToDataBaServerLogin.java
Method: POST
Content-Type: application/x-www-form-urlencoded
Request Parameters:
opt: Operation type (“login”, “warehouse”, “checkActivation”)token: User token (for login)keyWh: Warehouse keydeviceId: Device serial numberEndpoint: /android/replenishment1.12.0.php
Class: ConnectToDataBaseServerReplenishment.java
Method: POST
Content-Type: application/x-www-form-urlencoded
Request Parameters:
TYPE: "Get_reple_uom"uomBarcode: UOM barcode to searchResponse (JSON Array):
[ { "Message": "success", "RequestID": "12345", "ComentRequest": "Comment text", "SKU": "SKU-123", "Description": "Product description", "ProductID": "456", "ProductIDWH": "789", "Upc": "1234567890", "AcountID": "10", "CompanyName": "Company Name", "DateStatus": "2024-01-15", "RequestDetallID": "111", "NameSupplier": "Supplier Name", "Weight": "1.5", "QtyRequest": "10", "po_num": "PO-123", "lot": "LOT-001", "expir": "2025-12-31", "uomId": "1", "uomName": "Each", "unit_factor": "1", "activeLot": "1", "serial_num": "0", "serials": "", "url": "https://example.com/image.jpg", "tracking_num": "TRACK-123", "sku_img": "image_url", "qtyImg": "1", "main_img": "main_image_url", "id_img": "id_image_url", "barcode": "BARCODE-123" }]Error Messages:
"Wrong uom barcode" - Invalid UOM barcode"There are not replenishments with this uom bracode" - No replenishments found"There was an error try again please" - Server error"Connection error" - Network errorEndpoint: /android/pickandpack1.15.0.php
Class: ConnectToDataBaseServerToPickAsync.java
Method: POST
Content-Type: application/json
Request Body (JSON):
{ "opt": "Get_order_from_summary_1", "userId": "12345", "serialDevice": "DEVICE-123", "bracodeSummary": "SUMMARY-BARCODE"}Alternative Request:
{ "opt": "Get_order_from_job", "userId": "12345", "serialDevice": "DEVICE-123", "barcodeJob": "JOB-BARCODE"}Response: JSON array with order details
Endpoint: /android/pickandpack1.11.0.php
Request Body (JSON):
{ "opt": "Get_order_from_location", "userId": "12345", "serialDevice": "DEVICE-123", "location": "A-1-2-3"}Endpoint: /android/return.php
Class: ConnectToDataBaseServerReturn.java
Method: POST
Content-Type: application/x-www-form-urlencoded
Request Parameters:
key: Operation key (e.g., “GetReturnDetails”)param: Search parameter (Tracking#, Shipping#, or RMA)Response (JSON Array):
[ { "ID": "RMA-123", "OrderID": "SHIP-456", "AcountName": "Customer Name", "Request_Type": "Return", "Tracking#": "TRACK-789", "custFName": "John", "custLName": "Doe", "custBillZip": "12345", "items": "2", "Skus": "SKU-123,SKU-456", "OrderDate": "2024-01-10", "Process_date": "2024-01-15", "OrderStatus": "IN-TRANSIT" }]Usage:
public class ConnectToDataBaseServerReturn { String param,warehouse,key; public ConnectToDataBaseServerReturn(String param,String warehouse,String key){ if(!warehouse.equals("ut1")){ warehouse="https://"+warehouse+".shipedge.com/android/return.php"; } else{ warehouse="https://"+warehouse+".shipedge.com/android/return.php"; }
this.warehouse=warehouse; this.param=param; this.key=key;
}Endpoint: /android/inventoryControl1.15.0.php
Class: ConnectToDataBaseServer.java
Method: POST
Content-Type: application/x-www-form-urlencoded
Request Parameters:
key: "BinDetails"name: Bin identifier (bin code or location)Response (JSON Array):
[ { "Sku": "SKU-123", "QtyProductID": "50", "Upc": "1234567890", "Description": "Product description", "BIN": "A-1-2", "CompanyName": "Company Name", "ProductID": "456", "ProductIDWH": "789", "AcountID": "10", "BinID": "123", "UnitVolumenPrice": "1.5", "lot": "LOT-001", "expir": "2025-12-31", "UOM": "1", "name": "Each", "unit_factor": "1", "QtyProcessing": "5", "id_location": "100", "location": "A-1-2-3", "serial_num": "0", "bin_tag": "TAG-123", "sku_img": "image_url", "qtyImg": "1", "id_img": "id_image_url", "main_img": "main_image_url", "bincategory_id": "1", "category": "Category Name", "lpn": "LPN-123" }]Error Response:
[ { "Sku": "Error2" }]Endpoint: /android/confirmation1.2.0.php
Service: CycleCountService.java
Method: POST
Content-Type: application/json
Headers:
token: Authentication tokenRequest Body:
{ "action": "filterInit", "limite": 50, "offset": 0, "filter": "", "quantity": "", "accountId": "", "checked": "0", "checkedG": "0"}Response:
{ "success": true, "message": "success", "zeroBins": [...], "accounts": [...], "countBins": "100"}Endpoint: /android/confirmation1.2.0.php
Request Body:
{ "action": "deleteBin", "binId": "123", "token": "user_token"}Endpoint: /android/confirmation1.2.0.php
Request Body:
{ "action": "doneBin", "binId": "123", "quantity": "50", "token": "user_token"}Endpoint: /android/confirmation1.3.0.php
Request Body:
{ "action": "recountBin", "binId": "123", "quantity": "50", "token": "user_token"}Most endpoints include these common parameters:
userId: User ID from login (stored in Users.userId)serialDevice: Device serial number (from Device.serialDevice)warehouse: Warehouse identifier (from Users.warehouse)token: Authentication token (for Retrofit endpoints)opt parameter)Common operation types used across endpoints:
"Get_reple_uom" - Get replenishment by UOM"Get_order_from_summary_1" - Get order from summary barcode"Get_order_from_job" - Get order from job barcode"Get_order_from_location" - Get order from location"BinDetails" - Get bin details"login" - Login operation"checkActivation" - Check device activationMost endpoints return a JSON array with success data:
[ { "Message": "success", // ... data fields }]Error responses typically include:
[ { "Message": "error", // or specific error message }]Common Error Messages:
"Error1" - Connection error"Error2" - Invalid data"Error" - General error"Connection error" - Network failure"There was an error try again please" - Server errorLegacy Pattern (Apache HttpClient):
JSONArray jArray = new JSONArray(result);JSONObject json_data = jArray.getJSONObject(0);String message = json_data.getString("Message");Modern Pattern (Retrofit):
if (response.isSuccessful()) { ResponseObject data = response.body(); if (data.isSuccessful()) { // Process data } else { // Handle error from data.getMessage() }}Legacy Classes:
CONNECTION_TIMEOUT: 3000ms (3 seconds)READ_TIMEOUT: 20000ms (20 seconds) or 30000ms (30 seconds)Example:
int CONNECTION_TIMEOUT = 3000; int READ_TIMEOUT = 20000;Timeout errors are detected and handled:
catch (SocketTimeoutException e) { swTimeOutConnection = 1; // Handle timeout}Check Network Connection:
public static boolean checkNetwork(Context ctx){ ConnectivityManager cm = (ConnectivityManager)ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if(netInfo == null || !netInfo.isConnected()){ return false; } return true; }Legacy Pattern:
try { JSONArray jArray = new JSONArray(result); JSONObject json_data = jArray.getJSONObject(0); String message = json_data.getString("Message");
if (message.equals("error") || message.equals("Error1")) { // Handle error }} catch (JSONException e) { // Handle JSON parsing error}Modern Pattern (Retrofit):
call.enqueue(new Callback<ResponseType>() { @Override public void onResponse(Call<ResponseType> call, Response<ResponseType> response) { if (!response.isSuccessful()) { callback.onError(ERROR, "Server error: " + response.message()); return; } ResponseType data = response.body(); if (!data.isSuccessful()) { callback.onError(ERROR, data.getMessage()); return; } // Process success }
@Override public void onFailure(Call<ResponseType> call, Throwable t) { callback.onError(ERROR, "Network error: " + t.getMessage()); }});/android/login_last.php - Modern login/android/login1.2.0.php - Legacy login/android/replenishment1.12.0.php - Get replenishment by UOM/android/replenishment1.14.0.php - Replenishment operations/android/pickandpack1.11.0.php - Legacy picking operations/android/pickandpack1.12.0.php - Picking operations/android/pickandpack1.13.0.php - Picking operations/android/pickandpack1.14.0.php - Picking operations/android/pickandpack1.15.0.php - Modern picking operations/android/inventoryControl1.13.0.php - Inventory operations/android/inventoryControl1.14.0.php - Inventory operations/android/inventoryControl1.15.0.php - Bin details/android/inventoryControl1.17.0.php - Inventory operations/android/inventoryControl1.18.0.php - Inventory operations/android/confirmation1.2.0.php - Cycle count operations (MVP)/android/confirmation1.3.0.php - Cycle count recount/android/return.php - Return operations/android/tasks1.6.0.php - Task operations/android/uomAndroid.php - UOM operations/android/lpn.php - LPN operations/android/lpn1.php - LPN operations/android/pickLabelReady.php - Label operations/android/putPost1.php - Post operationsFor new features, use Retrofit pattern like MVP modules. It provides better error handling, type safety, and asynchronous execution.
Always set appropriate timeout values and handle timeout exceptions. Network conditions in warehouses can be unstable.
Use UtilService.checkNetwork() before making API calls to provide better error messages to users.
Always check the “Message” field in responses for error conditions. Don’t assume success based on HTTP status code alone.
Use Users.warehouse for warehouse identifier. Don’t hardcode warehouse names in API calls.
Never make API calls on the main UI thread. Use AsyncTask or Retrofit callbacks for background execution.
Issue: Connection timeout
Solution:
UtilService.checkNetwork()Issue: Authentication errors
Solution:
Users.userId is set after logincheckActivation endpoint)Issue: JSON parsing errors
Solution:
Issue: Wrong endpoint version
Solution: