Page tree
Skip to end of metadata
Go to start of metadata
URLMethodParametersResults
/api/v1/devicesGET

Get all the devices this user has access to

/api/v1/devices/{id}GET

{id} - id of the device

Gets a device with the given id
/api/v1/devices/{id}POST

{id} - id of the device

 name (optional) - new name of the device

notes (optional) - new notes of the device

category (optional) - new category of the device

 (allowed categories: WATCH / TABLET / PHONE / UNKNOWN)

Change the device's name, notes or category
/api/v1/devices/{id}/reservationsGET

{id} - id of the device

start - YYYY-MM-DD-hh-mm-ss

end - YYYY-MM-DD-hh-mm-ss

current_timestamp - YYYY-MM-DD-hh-mm-ss

Get all devices' reservations in Client time.

Given that all 3 parameters are given in the user time.

/api/v1/devices/{id}/reservations/newPOST

{id} - id of the device

start - YYYY-MM-DD-hh-mm-ss

end - YYYY-MM-DD-hh-mm-ss

clientCurrentTimestamp- YYYY-MM-DD-hh-mm-ss

userId (optional) - id of a user

projectId (optional) - id of a project

notes(optional) - a reason for this reservation

Reserves a device for the current user or the user with the userId if given.

If the reservation user has one project, the reservation project will be the user's project. Otherwise, the project id must be specified.

/api/v1/devices/{id}/releasePOST{id} - id of the deviceReleases the device from its current user.
/api/v1/devices/{id}/rebootPOST{id} - id of the deviceReboot the device.
/api/v1/devices/{id}/resetusbPOST{id} - id of the deviceResets the USB Connection.
/api/v1/devices/{id}/app-container/{bundle-id}GET

{id} - id of the device

{bundle-id} - bundle id of the application

(Only for iOS) - App container download as a zip file, file name: '{bundle-id}.zip'

  • The device must be reserved by User
  • The app must be built for debugging
/api/v1/devices/{id}/web-controlPUT

{id} - id of the device

type:

0 - Manual

1 - View

2 - Automation

3 - Debug


emulatorInstanceName - Optional

start web access control to the device

When choosing 'Debug' option - Grid must run (from the same user who ran the API)


  • Actions marked in blue are also Available also for Users.
  • Authorization Method can also be applied with Access Key, Click Here  to Learn More

Code Examples

Part of the examples below using the Unirest HTTP library.  To compile and run them, use the following Maven dependency:

<dependency>
    <groupId>com.mashape.unirest</groupId>
    <artifactId>unirest-java</artifactId>
    <version>1.4.9</version>
</dependency>
GetDevices
package manageDevices;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void GetDevices () throws UnirestException {

		String url = urlBase + "api/v1/devices";

		HttpResponse<String> response = Unirest.get (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
GetDeviceReservations
package manageDevices;
import java.text.SimpleDateFormat;
import java.util.Calendar;


import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void GetDeviceReservations () throws UnirestException {

		String deviceID = "6";//TODO projectID
		String timeStamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Calendar.getInstance().getTime());
        String startTime = "2018-08-01-00-00-00";//TODO: startTime
        String endTime =   "2018-08-14-18-00-00";//TODO: endTime
        
        String url = urlBase + "api/v1/devices/" + deviceID + "/reservations"  +
                "?current_timestamp=" + timeStamp + "&start=" + startTime + "&end=" + endTime ;;
                
		HttpResponse<String> response = Unirest.get (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
GetSpecificDevice
package manageDevices;


import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void GetDevice () throws UnirestException {

		String deviceID = "4";//TODO deviceID
		String url = urlBase + "api/v1/devices/" + deviceID;

		HttpResponse<String> response = Unirest.get (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
ReleaseDevice
package manageDevices;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void ReleaseDevice () throws UnirestException {

		String deviceID = "6";//TODO: deviceID
		String url = urlBase + "api/v1/devices/" + deviceID + "/release";

		HttpResponse<String> response = Unirest.post (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
RebootDevice
package manageDevices;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here

	public void rebootDevice () throws UnirestException {

		String deviceID = "6";//TODO: deviceID
		String url = urlBase + "api/v1/devices/" + deviceID + "/reboot";

		HttpResponse<String> response = Unirest.post (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
ReserveDevice
package manageDevices;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here

	public void ReserveDevice () throws UnirestException {

		String deviceID = "6";//TODO: deviceID
		String timeStamp  = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Calendar.getInstance().getTime());
		String startTime ="2018-08-15-13-40-00";//TODO: startTime
	    String endTime = "2018-08-15-14-00-00";//TODO: endTime
  
		String url = urlBase + "api/v1/devices/" + deviceID + "/reservations/new";

		HttpResponse<String> response = Unirest.post (url)
				.basicAuth (user, password)
				.queryString ("clientCurrentTimestamp", timeStamp)
				.queryString ("start",startTime)
				.queryString ("end",endTime)
				.queryString ("userId", "3") //TODO: user ID (optional) 
				.queryString ("projectId", "2")//TODO: project ID (optional) 
				.asString ();

		System.out.println (response.getBody ());
	}
}
ResetDeviceUSBConnection
package manageDevices;


import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void ResetDeviceUSBConnection () throws UnirestException {

		String deviceID = "6";//TODO: projectID

		String url = urlBase + "api/v1/devices/" + deviceID + "/resetusb";

		HttpResponse<String> response = Unirest.post (url)
				.basicAuth (user, password)
				.asString ();

		System.out.println (response.getBody ());
	}
}
get App-container
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest; //TODO see Unirest explanation above
import com.mashape.unirest.http.exceptions.UnirestException;
import org.junit.Test;

public class DeviceExamples {

    // TODO modify hostname and port, admin user name and password as applicable your environment
    String urlBase = "http://hostname:port/";
    String userName = "admin";
    String password = "adminPassword";

    @Test
    public void getAppContainer() throws UnirestException {
        String deviceId = "2"; //TODO modify the device id as applicable your environment
        String bundleId = path; //TODO modify the bundle id of the application as applicable your environment
        String url = urlBase + "api/v1/devices/" + deviceId + "/app-container/" + bundleId;

        HttpResponse<String> response = Unirest.get (url)
                .basicAuth (userName, password)
                .asString ();

        System.out.println (response.getBody ());
    }
}
WebControl
package manageDevices;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
 
public class Device{
 
    private String host = "ServerIP";//TODO: IP goes here
    private String port = "port";//TODO: open port goes here
    String urlBase = "http://host:port/";
    String user = "admin";  //TODO: user name goes here
    String password = "password";   //TODO: password goes here


	public void ReleaseDevice () throws UnirestException {

		String url = URL_Base + FOLDER_URL + "/devices/{device-id}/web-control";
		System.out.println(url);
		HttpResponse<String> response = Unirest.put(url)
				.basicAuth (user, password)
				.queryString("type", "0") //Manual Option
				.asString ();
		System.out.println("url="+url);
		System.out.println (response.getBody());  
	}
}
  • No labels