Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Last updated: Nov 02, 2016 18:54

Get started with the Perfecto REST APIs, a RESTful web service that provides an interface for accessing CQ Lab functionality and data from a remote client over the web.

API Operations

The following API operations are available:

OperationDescription
CommandExecute Perfecto proprietary commands
ScriptStart script executions, get status, aborting and listing
ReportDownload reports, images, video, vitals & network information
RepositoryUpload & Download items, list, delete and clean the repository
Device, Device Host & CradleGet info on one or all devices, device hosts, or cradles
SchedulerCreate, update, delete and list scheduled scripts
User & AccountCreate, update, list and delete users
GroupCreate, update, list and delete groups
ReservationReserve devices

URL Structure

The following is the API URL request structure:

https://<hostName>/services/<resourceGroup>/<resourceIdentifier>?operation=<value>&<requiredParameter>=<value>&<optionalParameter>=value
  • <hostName>: Host name of for the service. For example, mycloud.perfectomobile.com.

  • <resourceGroup>: a resource group. For example, executions.

  • <resourceIdentifier>: A resource identifier. This is only required if the API call is on a specific resource such as aborting a specific execution.

  • operation: The operation to perform. For example, abort.

  • <requiredParameters>: One or more required parameters specified using name-value pairs prefixed by the & character. For example, &user=myUser&password=myPassword.

  • <optional parameters>: One or more optional parameters specified using name-value pairs prefixed by the & character. For example, &responseFormat=XML.

Authentication & Authorization

It is required to send the user and password for authentication in each request.

Some operations require specific user permissions. For example user operations requires administrator or user management role.

Protocols

The API request can be transmitted to the API server using either the GET or the POST HTTP methods. To use the GET method, simply specify the request as a URL. Parameter values must be encoded to prevent conflicts with HTTP special characters. The following example shows the URL for getting a list of all connected handsets in mycloud.

https://mycloud.perfectomobile.com/services/handsets?operation=list&user=myUsername&password=myPassword&status=connected

You can get the same list using the POST method specifying the POST parameters as follows:

URL: https://mycloud.perfectomobile.com/services/handsets
Request: operation=list&user=myUsername&password=myPassword&status=connected

Operations that upload files to the Perfecto repository must use POST or PUT method.

Response Formats

The default response format is JSON. Most operations support the optional parameter responseFormat for specifying the required format. A few operations support only XML response format.

  • JSON - For more information about the JSON format, see http://www.json.org.
  • XML - the response is an XML document.

The following examples show the response type for a request to start a new execution:

JSON

{"executionId":"academy@perfectomobile.com_1_15-11-01_09_11_26_31261 ","reportKey":"PRIVATE:1_15-11-01_09_11_26_31261.xml "}

XML

<response>
 <executionId>academy@perfectomobile.com_1_15-11-01_09_11_26_31261</executionId>
 <reportKey>PRIVATE:1_15-11-01_09_11_26_31261.xml</reportKey>
</response>
 

Test Your API Access

  1. Open a web browser.
  2. Type: https://myCloud.perfectomobile.com/services/handsets?operation=list&user=myUser&password=myPassword
    in the address bar, substituting myCloud, myUsename, and myPassword as appropriate, and then type ENTER.
  3. Confirm that an XML list of devices is returned by the API.

 

  • No labels