### Install Appetize Playwright Integration
Source: https://docs.appetize.io/testing/getting-started
Installs the Playwright integration for Appetize using npm. This command sets up a new project with Playwright and configures it for Appetize, prompting the user for their build ID and preferred default device.
```bash
npm init @appetize/playwright@latest
```
--------------------------------
### Install APK using ADB
Source: https://docs.appetize.io/platform/app-management/uploading-apps/android
Command to install an APK file onto an Android emulator or device using the Android Debug Bridge (ADB). This is a troubleshooting step to verify the APK runs correctly before uploading to Appetize.io.
```shell
adb install -r {your app}.apk
```
--------------------------------
### Start Appetize Session using Javascript SDK
Source: https://docs.appetize.io/guides-and-samples/screenshot-automation
This code snippet shows how to initialize a new session with the Appetize Javascript SDK. Ensure you have followed the 'Getting Started' guide for setting up the SDK before executing this command. This is a prerequisite for taking screenshots or listening to session events.
```typescript
const session = await client.startSession()
```
--------------------------------
### Initialization API
Source: https://docs.appetize.io/javascript-sdk/api-reference
Documentation for the Initialization API, which is used to set up and start new sessions.
```APIDOC
## Initialization API
### Description
This section details the Initialization API, used for starting and configuring new application sessions.
### Method
GET
### Endpoint
/api-reference/initialization
### Parameters
This endpoint does not have any documented parameters.
### Request Example
```json
{
"example": "No specific request example provided for initialization setup."
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the initialization.
- **session_id** (string) - The unique identifier for the newly created session.
#### Response Example
```json
{
"status": "initialized",
"session_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}
```
```
--------------------------------
### Appetize.io URL Structure Example
Source: https://docs.appetize.io/platform/query-params-reference
This example demonstrates the general structure of an Appetize.io App or Embed link, including placeholders for the build/app/public key and optional query parameters. It shows how to append parameters like 'device' and 'language' to customize the simulation.
```url
https://appetize.io/{app/embed}/{buildId|appId|publicKey}?{queryParameter1}={value1}&{queryParameter2}={value2}
e.g.
https://appetize.io/app/1234?device=pixel4&language=en
```
--------------------------------
### JavaScript SDK Installation
Source: https://docs.appetize.io/javascript-sdk
Instructions on how to load the Appetize.io JavaScript SDK into your web page.
```APIDOC
## JavaScript SDK Installation
### Description
Load the JavaScript SDK by adding the following snippet to the `head` section of your HTML page.
### Method
N/A (Script tag inclusion)
### Endpoint
N/A
### Parameters
N/A
### Request Example
```html
```
### Response
N/A
```
--------------------------------
### Start Appetize Session
Source: https://docs.appetize.io/javascript-sdk
Initiates an emulation session for an embedded app. Sessions can be started programmatically using the client instance or by listening for user interaction events like 'Tap to Play'.
```javascript
const session = await client.startSession()
console.log('session started!')
```
```javascript
client.on("session", session => {
console.log('session started!')
})
```
--------------------------------
### Example Playwright Test with Appetize Session
Source: https://docs.appetize.io/testing/getting-started
An example test case using the Appetize Playwright integration. It demonstrates how to import the 'test' and 'expect' from '@appetize/playwright' and use the 'session' object to assert the presence of an element with specific attributes within the mobile application. Replace 'Hello world' with actual element text from your app.
```javascript
import { test, expect } from '@appetize/playwright'
test('example test', async ({ session }) => {
await expect(session).toHaveElement({
attributes: {
// replace with the text of an element that appears on your app
text: 'Hello world'
}
})
})
```
--------------------------------
### Client - startSession
Source: https://docs.appetize.io/javascript-sdk/automation/device-commands
Starts a new session with the specified app, device, and operating system configurations.
```APIDOC
## POST /client/startSession
### Description
Starts a session with the requested app, device, operating system, and other launch options.
### Method
POST
### Endpoint
/client/startSession
### Parameters
#### Request Body
- **config** (Record) - Optional - A JSON object describing the configuration options for the device.
### Request Example
```json
{
"config": {
"appName": "my-app",
"platformName": "android",
"platformVersion": "10",
"deviceName": "pixel 4"
}
}
```
### Response
#### Success Response (200)
- **session_id** (string) - The ID of the newly created session.
#### Response Example
```json
{
"session_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}
```
```
--------------------------------
### GET /getClient (Initialization with Config)
Source: https://docs.appetize.io/javascript-sdk/api-reference/initialization
Initializes the Appetize client with a selector and provides an initial configuration object for the session.
```APIDOC
## GET /getClient (Initialization with Config)
### Description
Get an instance of the Appetize client and set the initial configuration for the session. This is useful when the embed link is not known upfront and configuration needs to be applied at runtime.
### Method
GET
### Endpoint
`window.appetize.getClient(selector, config)`
### Parameters
#### Path Parameters
#### Query Parameters
#### Request Body
### Request Example
```javascript
const client = await window.appetize.getClient('#my_iframe', {
buildId: '{buildId|publicKey}',
device: 'iphone11pro',
osVersion: '15.0'
...
})
```
### Parameters
#### Path Parameters
#### Query Parameters
#### Request Body
- **selector** (string) - Required - A query selector string pointing to the embedded iframe.
- **config** (object) - Required - A JSON object describing the Configuration options for the device. See [SessionConfig](https://docs.appetize.io/javascript-sdk/api-reference/types/sessionconfig).
### Request Example
```javascript
const client = await window.appetize.getClient('#my_iframe', {
buildId: '{buildId|publicKey}',
device: 'iphone11pro',
osVersion: '15.0'
...
})
```
### Response
#### Success Response (200)
- **client** (object) - An instance of the Appetize client with the specified configuration.
#### Response Example
```json
{
"client": "[Appetize Client Object]"
}
```
```
--------------------------------
### Starting an Appetize Session
Source: https://docs.appetize.io/javascript-sdk
Programmatically start a new session for your embedded Appetize app or listen for session events.
```APIDOC
## Starting a Session
### Description
Initiate a session for your embedded Appetize application either programmatically or by waiting for user interaction.
### Method
JavaScript Function Call / Event Listener
### Endpoint
`client.startSession()` or `client.on("session", callback)`
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
**Programmatic Start:**
```javascript
const session = await client.startSession();
console.log('session started!');
```
**Event Listener:**
```javascript
client.on("session", session => {
console.log('session started!');
});
```
### Response
#### Success Response (200)
- **session** (object) - Represents the started session (when using `startSession`).
#### Response Example
```javascript
// Session object is returned or a log message is printed on session start.
```
```
--------------------------------
### Iterate and Capture Screenshots for Multiple Apps and Devices
Source: https://docs.appetize.io/guides-and-samples/screenshot-automation
This snippet demonstrates how to iterate through a configuration object containing apps, devices, languages, and screens to start sessions, set languages, and capture screenshots for each screen. It shows two methods for handling screenshots: remote upload and local in-memory storage. Consider updating existing sessions using `setLanguage()` instead of starting new ones with `startSession/setConfig()`.
```javascript
for (const app of config.apps) {
for (const device of app.devices) {
const sessionConfig = {
publicKey: app.publicKey,
device: device.device,
osVersion: device.osVersion,
}
const session = await client.startSession(sessionConfig);
for (const language of app.languages) {
await session.setLanguage(language);
for (const screen of app.screens) {
await screen.playbackActions(client, session, language);
const screenshot = await session.screenshot();
await uploadSomewhere(screenshot.data, screenshot.mimeType);
const screenshot = await session.screenshot('base64');
imageData.push({
data: screenshot.data,
mimeType: screenshot.mimeType,
action: action
});
}
}
}
}
```
--------------------------------
### Install Appetize.io JavaScript SDK
Source: https://docs.appetize.io/javascript-sdk
Loads the Appetize.io JavaScript SDK into your HTML page. This script should be placed in the head section and ensures the Appetize object is available globally.
```html
```
--------------------------------
### Get Appetize Client Instance
Source: https://docs.appetize.io/javascript-sdk
Retrieves an Appetize client instance for interacting with an embedded app. This function is asynchronous and requires the selector of the iframe element. It can also accept an optional configuration object for initial setup.
```javascript
const client = await window.appetize.getClient("#appetize")
```
```typescript
const client = await window.appetize.getClient("#appetize", {
buildId: '{buildId|publicKey}',
device: 'iphone13pro',
osVersion: '15.0'
...
})
```
--------------------------------
### GET /getClient (Basic Initialization)
Source: https://docs.appetize.io/javascript-sdk/api-reference/initialization
Initializes the Appetize client by providing a selector for the embedded iframe.
```APIDOC
## GET /getClient (Basic Initialization)
### Description
Get an instance of the Appetize client by providing a query selector for the embedded iframe.
### Method
GET
### Endpoint
`window.appetize.getClient(selector)`
### Parameters
#### Path Parameters
#### Query Parameters
#### Request Body
### Request Example
```javascript
const client = await window.appetize.getClient('#my_iframe')
```
### Response
#### Success Response (200)
- **client** (object) - An instance of the Appetize client.
#### Response Example
```json
{
"client": "[Appetize Client Object]"
}
```
```
--------------------------------
### Get Available Devices
Source: https://docs.appetize.io/rest-api/devices-and-os-versions/v1
Retrieves a list of all available devices and their corresponding operating systems supported by Appetize.
```APIDOC
## GET /available-devices
### Description
Get the list of available devices and operating systems.
### Method
GET
### Endpoint
/available-devices
### Parameters
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **ios** (object) - An object where keys are iOS versions and values are arrays of device models.
- **android** (object) - An object where keys are Android versions and values are arrays of device models.
#### Response Example
```json
{
"ios": {
"15.5": [
"iPhone 13 Pro",
"iPhone 13",
"iPhone 12 Pro",
"iPhone 12",
"iPhone SE (3rd generation)",
"iPhone 11",
"iPhone XR",
"iPad Air (5th generation)",
"iPad Pro (12.9-inch) (5th generation)",
"iPad Pro (11-inch) (3rd generation)",
"iPad (9th generation)",
"iPad mini (6th generation)"
],
"14.8": [
"iPhone 13 Pro",
"iPhone 13",
"iPhone 12 Pro",
"iPhone 12",
"iPhone SE (2nd generation)",
"iPhone 11",
"iPhone XR",
"iPhone 8",
"iPad Air (4th generation)",
"iPad Pro (11-inch) (2nd generation)",
"iPad Pro (12.9-inch) (4th generation)",
"iPad (8th generation)",
"iPad mini (5th generation)"
]
},
"android": {
"12": [
"Pixel 6 Pro",
"Pixel 6",
"Pixel 5",
"Pixel 4",
"Samsung Galaxy S22 Ultra",
"Samsung Galaxy S21",
"Samsung Galaxy Z Fold3",
"Samsung Galaxy A52"
],
"11": [
"Pixel 5",
"Pixel 4",
"Pixel 3",
"Samsung Galaxy S21",
"Samsung Galaxy S20",
"Samsung Galaxy Z Fold2",
"Samsung Galaxy A51"
]
}
}
```
```
--------------------------------
### TypeScript Function to Start Appetize Session
Source: https://docs.appetize.io/guides-and-samples/automate-sign-in-flow
This TypeScript code attaches an event listener to the 'Start New Session' button. When clicked, it calls `window.client.startSession()` to initiate a new session with the Appetize client, handling potential errors.
```typescript
startSessionButton.addEventListener('click', async function(event) {
if(!window.client) { return; }
try {
await window.client.startSession();
} catch (error) {
console.error(error);
}
});
```
--------------------------------
### Build APK with Gradle
Source: https://docs.appetize.io/platform/app-management/uploading-apps/android
Command to generate an APK file using Gradle for a specific build variant, typically used when Android Studio is not preferred. The output APK is located in the build outputs directory.
```shell
./gradlew assembleDebug
```
--------------------------------
### HTML/JavaScript: WebView Selector Example
Source: https://docs.appetize.io/javascript-sdk/automation/automation-engine-migration-guide
Illustrates targeting an HTML button within a WebView using its visible text content, as 'id' attributes are not exposed. It also shows the corresponding JavaScript code to perform a tap action on this element.
```html
```
```javascript
await session.tap({
element: { attributes: { text: 'Continue checkout' } }
});
```
--------------------------------
### Start Appetize Session with Configuration (JavaScript)
Source: https://docs.appetize.io/javascript-sdk/configuration
Initiates a new session with specific device and OS version configurations. This method allows for programmatic control over the embedded app's environment. It requires the `client` object to be initialized.
```javascript
const session = await client.startSession({
device: 'iphone11pro',
osVersion: '15.0'
})
```
--------------------------------
### Configure Appetize Client Settings (JavaScript)
Source: https://docs.appetize.io/javascript-sdk/configuration
Programmatically sets configuration options for the Appetize.io client before a session starts. This includes specifying the device and OS version. It requires the `client` object to be initialized.
```javascript
await client.setConfig({
device: 'iphone11pro',
osVersion: '15.0'
})
```
--------------------------------
### Initialize Appetize Client with Selector
Source: https://docs.appetize.io/javascript-sdk/api-reference/initialization
Retrieves an instance of the Appetize client by providing a CSS selector for the embedded iframe. This method is suitable for basic setup where configuration is handled separately.
```javascript
const client = await window.appetize.getClient('#my_iframe')
```
--------------------------------
### Deep Linking to Sign-in Screen (URL)
Source: https://docs.appetize.io/guides-and-samples/automate-sign-in-flow
This example shows how to use a deep link with Appetize.io to directly navigate to the sign-in screen of your application, bypassing introductory flows. This is part of automating the user experience.
```url
https://appetize.io/app/{public_key}?launchUrl=yourapp://signin
```
--------------------------------
### Reinstall Current Application
Source: https://docs.appetize.io/javascript-sdk/automation/device-commands
Uninstalls and then reinstalls the current application within the session. This ensures a clean installation, removing any previous data or state.
```typescript
await session.reinstallApp()
```
--------------------------------
### Get Appetize Client
Source: https://docs.appetize.io/javascript-sdk
Retrieve an Appetize client instance for interacting with the embedded app.
```APIDOC
## Get the Client
### Description
Obtain an Appetize client instance to interact with your embedded app. You can get the client using a CSS selector for the iframe.
### Method
JavaScript Function Call
### Endpoint
`window.appetize.getClient(selector)`
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```javascript
const client = await window.appetize.getClient("#appetize");
```
### Response
#### Success Response (200)
- **client** (object) - An Appetize client instance.
#### Response Example
```javascript
// client object is returned
```
### Notes
An optional configuration object can be passed as the second argument to `getClient` for scenarios where the `iframe` `src` is not initially set. This allows for initial configuration of the embed, such as `buildId`, `device`, and `osVersion`.
```typescript
const client = await window.appetize.getClient("#appetize", {
buildId: '{buildId|publicKey}',
device: 'iphone13pro',
osVersion: '15.0'
// ... other configuration options
});
```
The base URL for the embed can be overridden using the `data-appetize-url` attribute on the `iframe` element.
```
--------------------------------
### Get Application UI as XML
Source: https://docs.appetize.io/javascript-sdk/api-reference/session
Retrieves the current user interface of the application as an XML string. This is an experimental feature, and the response structure may change.
```typescript
await session.getUI()
```
--------------------------------
### GET /v1/apps
Source: https://docs.appetize.io/rest-api
Retrieves a list of all applications associated with your account.
```APIDOC
## GET /v1/apps
### Description
Fetches a list of all applications uploaded to your Appetize.io account.
### Method
GET
### Endpoint
`https://api.appetize.io/v1/apps`
### Parameters
#### Headers
- **X-API-KEY** (string) - Required - Your API authentication token.
#### Query Parameters
- **platform** (string) - Optional - Filter by platform (`ios` or `android`).
### Request Example (cURL)
```bash
curl -X GET https://api.appetize.io/v1/apps \
-H "X-API-KEY: your_api_token"
```
### Response
#### Success Response (200)
- **apps** (array) - A list of application objects.
- **publicKey** (string) - The public key of the application.
- **appURL** (string) - The public URL of the application.
- **platform** (string) - The platform of the application (`ios` or `android`).
- **createdAt** (string) - The timestamp when the application was created.
#### Response Example
```json
{
"apps": [
{
"publicKey": "a1b2c3d4e5f6",
"appURL": "https://appetize.io/app/a1b2c3d4e5f6",
"platform": "ios",
"createdAt": "2023-10-27T10:00:00Z"
},
{
"publicKey": "f6e5d4c3b2a1",
"appURL": "https://appetize.io/app/f6e5d4c3b2a1",
"platform": "android",
"createdAt": "2023-10-26T15:30:00Z"
}
]
}
```
#### Error Responses
- **401 Unauthorized**: Invalid or missing API token.
```
--------------------------------
### Convert AAB to Universal APKs with bundletool
Source: https://docs.appetize.io/platform/app-management/uploading-apps/android
Shell command to generate a universal APK archive from an Android App Bundle (AAB) using Google's bundletool. This is a necessary step for Appetize.io as it only supports APK files.
```shell
bundletool build-apks --bundle=//{aab name}.aab \
--output=/{your app}/{app name}.apks \
--mode=universal
```
--------------------------------
### GET /v2/service/devices
Source: https://docs.appetize.io/rest-api/devices-and-os-versions
Retrieves a list of all available devices and their supported operating system versions.
```APIDOC
## GET /v2/service/devices
### Description
Get the list of available devices and operating systems.
### Method
GET
### Endpoint
/v2/service/devices
### Parameters
### Request Example
(No request body for GET requests)
### Response
#### Success Response (200)
- **id** (string) - ID of the device (ie. for device selection in url params).
- **name** (string) - Name of the device
- **platform** (string) - OS that the device runs. (enum: ["ios", "android"])
- **osVersions** (array of strings) - Array of os versions.
#### Response Example
```json
[
{
"id": "iphone_11",
"name": "iPhone 11",
"platform": "ios",
"osVersions": ["13.0", "14.0", "15.0"]
},
{
"id": "pixel_5",
"name": "Pixel 5",
"platform": "android",
"osVersions": ["10", "11", "12"]
}
]
```
```
--------------------------------
### Session Management
Source: https://docs.appetize.io/javascript-sdk/api-reference/client
Manage the lifecycle of your application sessions using methods to start, end, and configure sessions.
```APIDOC
## Client.startSession()
### Description
Starts a session with the requested app, device, operating system, and other launch options.
### Method
`startSession()`
### Endpoint
N/A (Client-side method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **config?** (SessionConfig) - Optional - A JSON object describing the configuration options for the device.
### Request Example
```typescript
const session = await client.startSession()
```
### Response
#### Success Response (200)
Returns the initiated session object.
#### Response Example
```json
{
"example": "session object"
}
```
```
```APIDOC
## Client.endSession()
### Description
Ends the active session or cancels any pending session requests.
### Method
`endSession()`
### Endpoint
N/A (Client-side method)
### Parameters
None
### Request Example
```typescript
await client.endSession()
```
### Response
#### Success Response (200)
Indicates the session has been ended or cancelled.
#### Response Example
None
```
--------------------------------
### Run Playwright Tests with Appetize
Source: https://docs.appetize.io/testing/getting-started
Commands to execute Playwright tests integrated with Appetize. The `--headed` flag runs the tests with a visible browser window, while running without it executes the tests headlessly.
```bash
npx playwright test --headed
```
```bash
npx playwright test
```
--------------------------------
### Set Device and OS Version via URL Query Parameters
Source: https://docs.appetize.io/features/devices-and-os-versions
This example demonstrates how to specify a device and its operating system version using query parameters in a URL for Appetize.io. This method allows for dynamic selection of the testing environment directly within the application or embed URL. Ensure you use the correct device identifiers as listed in the Appetize.io documentation.
```uri
&device=pixel4&osVersion=12.0
```
--------------------------------
### Extract Single APK from Universal APKs
Source: https://docs.appetize.io/platform/app-management/uploading-apps/android
Shell command to extract a single APK file from a universal APK archive generated by bundletool. This is required because Appetize.io needs a standalone APK file.
```shell
unzip -p /{your app}/{app name}.apks universal.apk > /{your app}/{app name}.apk
```
--------------------------------
### JavaScript: Scroll and Tap Element
Source: https://docs.appetize.io/javascript-sdk/automation/automation-engine-migration-guide
Shows how to scroll down to bring an element into view and then tap it using JavaScript. This addresses the change in visibility semantics where off-screen elements are no longer interactable.
```javascript
await session.swipe({ gesture: 'up', duration: 600 });
await session.tap({
element: { attributes: { text: 'Past Articles' } }
});
```
--------------------------------
### getUI Response Structure: Before and After Comparison (JSON)
Source: https://docs.appetize.io/javascript-sdk/automation/automation-engine-migration-guide
Compares the JSON structure of the getUI response before and after the update. Before, app and system content were in separate 'app' type objects. After, all visible content, including Springboard, is consolidated within a single 'app' type object. This highlights the simplification achieved by the new response format.
```json
[
{
"type": "app",
"appId": {running app},
"children": [ ... ] // Your app content
},
{
"type": "app",
"appId": "com.apple.springboard",
"children": [ ... ] // Springboard (system UI) content
}
]
```
```json
[
{
"type": "app",
"appId": {possible appId},
"children": [ ... ] // All visible content on screen (e.g. Springboard related content too)
}
]
```
--------------------------------
### HTML Form for Session Input
Source: https://docs.appetize.io/guides-and-samples/automate-sign-in-flow
This HTML snippet defines input fields for username and password, and a button to initiate a new session. It's used to gather user credentials before starting an Appetize session.
```html
Start New Session
```
--------------------------------
### App Launching and Configuration Parameters
Source: https://docs.appetize.io/platform/query-params-reference
This section details various parameters used to configure the launch and behavior of an app instance on Appetize.io.
```APIDOC
## POST /launch (Hypothetical Endpoint for App Launch)
### Description
This section details various parameters used to configure the launch and behavior of an app instance on Appetize.io. These parameters are typically passed as query parameters or within a request body when initiating an app session.
### Method
POST (or GET with query parameters, depending on implementation)
### Endpoint
/websites/appetize_io (Illustrative endpoint based on project name)
### Parameters
#### Query Parameters
- **launchApp** (boolean | string) - Optional - Indicates whether an app launches after installation and allows specifying which installed app to open. Possible values: `false` (apps install but do not launch), `true` or `undefined` (default behavior), or an `appId` (e.g., `com.android.chrome`) to launch a specific installed app.
- **launchUrl** (string) - Optional - Specifies a deep link to open when the app is launched. The URL should be URL-encoded.
- **launchArgs** (string) - Optional (iOS Only) - Specifies a URL-encoded JSON array of strings to pass when launching the app.
- **debug** (boolean) - Optional - When true, allows viewing the debug log for the app. Defaults to `false`.
- **proxy** (string) - Optional - Specifies a proxy server to route network traffic. Supports HTTP Proxies. Use `intercept` for Appetize's intercepting proxy. The value should be a URL, URL-encoded if necessary.
- **enableAdb** (boolean) - Optional (Android Only) - On session start, generates an SSH tunnel to allow ADB connections to the emulator.
### Request Example
```json
{
"queryParameters": {
"launchApp": "com.example.myapp",
"launchUrl": "https%3A%2F%2Fwww.example.com",
"launchArgs": "%5B%22arg1%22%2C%20%22arg2%22%5D",
"debug": true,
"proxy": "http%3A%2F%2Fexample.com%3A8080%2F",
"enableAdb": true
}
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
- **sessionId** (string) - The unique identifier for the launched app session.
#### Response Example
```json
{
"status": "success",
"sessionId": "a1b2c3d4e5f6"
}
```
```
--------------------------------
### Get a Single App
Source: https://docs.appetize.io/rest-api/list-apps
Retrieves detailed information about a specific app using its public key. This endpoint allows you to fetch metadata such as creation date, platform, bundle identifier, version information, and icon URL.
```APIDOC
## GET /apps/{app_publicKey}
### Description
Retrieves information about a single app.
### Method
GET
### Endpoint
/apps/{app_publicKey}
### Parameters
#### Path Parameters
- **app_publicKey** (string) - Required - The publicKey for the app.
### Response
#### Success Response (200)
- **publicKey** (string) - The publicKey for the app.
- **created** (string) - The date and time when the app was created.
- **updated** (string) - The date and time when the app was last updated.
- **platform** (string) - The platform of the app (ios or android).
- **bundle** (string) - The app identifier of the app.
- **name** (string) - The name of the app.
- **appDisplayName** (string) - The display name of the app.
- **appVersionCode** (string) - The version code of the app.
- **appVersionName** (string) - The version name of the app.
- **versionCode** (integer) - The incremental version code, managed by Appetize, for the app.
- **iconUrl** (string) - The URL to the app's icon image.
#### Response Example
```json
{
"publicKey": "string",
"created": "string",
"updated": "string",
"platform": "string",
"bundle": "string",
"name": "string",
"appDisplayName": "string",
"appVersionCode": "string",
"appVersionName": "string",
"versionCode": 0,
"iconUrl": "string"
}
```
```
--------------------------------
### Upload New App via Curl
Source: https://docs.appetize.io/rest-api/direct-file-uploads
This example demonstrates how to upload a new app to Appetize.io using a direct file upload with curl. It requires a publicly accessible URL for the app file and specifies the platform. The 'file' field is used for local file uploads instead of the 'url' field.
```bash
curl -X POST https://api.appetize.io/v1/apps \
-H "X-API-KEY: your_api_token" \
-F "file=@file_to_upload.zip" \
-F "platform=ios"
```
--------------------------------
### Retrieve Launch Data in Android (Kotlin) via Intents and SharedPreferences
Source: https://docs.appetize.io/features/launch-params
Provides Kotlin code examples for retrieving launch parameters in an Android application. Data can be accessed via Intents as extras or by reading from SharedPreferences. Complex types require manual deserialization.
```kotlin
intent.getBooleanExtra("isAppetize", false)
intent.getStringExtra("stringKey")
...
```
```kotlin
val preferences = applicationContext.getSharedPreferences("prefs.db", Context.MODE_PRIVATE);
preferences.getBoolean("isAppetize", false)
preferences.getString("stringKey", null)
...
```
--------------------------------
### Reinstall Application
Source: https://docs.appetize.io/javascript-sdk/api-reference/session
Reinstalls the currently running application.
```APIDOC
## POST /session/reinstallApp
### Description
Reinstalls the currently running application.
### Method
POST
### Endpoint
/session/reinstallApp
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Get App Group Information - OpenAPI
Source: https://docs.appetize.io/rest-api/list-apps
This snippet outlines the OpenAPI 3.0.3 specification for retrieving details about an app group and its associated apps. It specifies the endpoint, required path parameter (app group public key starting with `ag_`), authentication via API token, and the JSON response structure, including group metadata and a list of app public keys. Proper authentication is necessary to access this information.
```json
{
"openapi": "3.0.3",
"info": {
"title": "Appetize API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.appetize.io/v1"
}
],
"security": [
{
"apiToken": []
}
],
"components": {
"securitySchemes": {
"apiToken": {
"type": "apiKey",
"in": "header",
"name": "X-API-KEY",
"description": "Use an API token for authentication via X-API-KEY header"
}
}
},
"paths": {
"/apps/{appgroup_publicKey}": {
"get": {
"summary": "Get an App Group",
"tags": [
"Listing Apps"
],
"description": "Retrieves information about an app group and all the apps associated with it.",
"parameters": [
{
"in": "path",
"name": "publicKey",
"required": true,
"schema": {
"type": "string"
},
"description": "The publicKey for the app group (starts with `ag_`)."
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"publicKey": {
"type": "string",
"description": "The publicKey for the app group."
},
"created": {
"type": "string",
"format": "date-time",
"description": "The date and time when the app group was created."
},
"updated": {
"type": "string",
"format": "date-time",
"description": "The date and time when the app group was last updated."
},
"createdBy": {
"type": "string",
"description": "The user who created the app group."
},
"name": {
"type": "string",
"description": "The name of the app group."
},
"apps": {
"type": "array",
"items": {
"type": "string",
"description": "The publicKeys of the apps in the app group."
}
}
}
}
}
}
}
}
}
}
}
}
```
--------------------------------
### Listen for Client Events with TypeScript
Source: https://docs.appetize.io/javascript-sdk/api-reference/client
The `on` method allows you to listen for various events emitted by the client. This example demonstrates how to log data received from the 'app' event. It's useful for tracking app loading status, device information, errors, and session events.
```typescript
client.on(event, data => {
console.log(data)
})
```
--------------------------------
### Retrieve Launch Data in Android (Java) via Intents and SharedPreferences
Source: https://docs.appetize.io/features/launch-params
Provides Java code examples for retrieving launch parameters in an Android application. Data can be accessed via Intents as extras or by reading from SharedPreferences. Complex types require manual deserialization.
```java
Intent intent = getIntent()
intent.getBooleanExtra("isAppetize", false);
intent.getStringExtra("stringKey");
...
```
```java
SharedPreferences preferences = getApplicationContext().getSharedPreferences("prefs.db", Context.MODE_PRIVATE);
preferences.getBoolean("isAppetize", false);
preferences.getString("stringKey", null);
...
```
--------------------------------
### Set Launch URL via Query Parameter
Source: https://docs.appetize.io/features/deep-links
Configure the deep-link URL to be launched when the device starts by appending the URL-encoded `launchUrl` query parameter to your app or embed URL. This method is useful for initial deep linking at app launch.
```url
&launchUrl=https%3A%2F%2Fwww.appetize.io
```
--------------------------------
### URL and Shell Commands
Source: https://docs.appetize.io/javascript-sdk/api-reference/session
APIs for opening URLs and executing ADB shell commands.
```APIDOC
## POST /session/:sessionId/openUrl
### Description
Opens a deep-link or web URL.
### Method
POST
### Endpoint
`/session/:sessionId/openUrl`
### Parameters
#### Request Body
- **url** (string) - Required - The URL to open.
### Request Example
```json
{
"url": "https://appetize.io"
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
#### Response Example
```json
{
"status": "success"
}
```
```
```APIDOC
## POST /session/:sessionId/adbShellCommand
### Description
Executes an `adb shell` command on the device (Android only).
### Method
POST
### Endpoint
`/session/:sessionId/adbShellCommand`
### Parameters
#### Request Body
- **command** (string) - Required - The adb shell command to execute.
### Request Example
```json
{
"command": "am start -a android.intent.action.VIEW -d https://appetize.io/"
}
```
### Response
#### Success Response (200)
- **output** (string) - The output of the adb shell command.
#### Response Example
```json
{
"output": "Starting activity..."
}
```
```
--------------------------------
### Get Available Devices (OpenAPI Spec)
Source: https://docs.appetize.io/rest-api/devices-and-os-versions
This OpenAPI 3.0.3 specification defines the GET endpoint '/v2/service/devices' for retrieving available devices and their OS versions. It outlines the request method, the structure of the response, including device ID, name, platform, and supported OS versions. No authentication is specified for this endpoint.
```json
{"openapi":"3.0.3","info":{"title":"Appetize V2 API Reference","version":"2"},"servers":[{"url":"https://api.appetize.io"}],"security":[],"paths":{"/v2/service/devices":{"get":{"tags":["Service"],"summary":"Get available devices","description":"Get the list of available devices and operating systems.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"ID of the device (ie. for device selection in url params)."},"name":{"type":"string","description":"Name of the device"},"platform":{"type":"string","enum":["ios","android"],"description":"OS that the device runs."},"osVersions":{"type":"array","items":{"type":"string"},"description":"Array of os versions."}}}}}}}}}}}}
```
--------------------------------
### Example Action Object Structure - Appetize.io
Source: https://docs.appetize.io/features/ui-automation
This code snippet illustrates the structure of a single action object that can be recorded and replayed using the Appetize.io Automation Recorder. It defines the properties of a 'click' action, including its type, position, and associated UI element text. This JSON-like structure is used for serializing and storing recorded interactions.
```json
{
"type": "click",
"xPos": 105,
"yPos": 645,
"element": {
"text": "Login"
}
}
```
--------------------------------
### Get All Apps - Paginated using JSON OpenAPI Spec
Source: https://docs.appetize.io/rest-api/list-apps
This snippet details the OpenAPI 3.0.3 specification for paginated retrieval of app data. It describes the GET request to the /apps endpoint, including query parameters like 'nextKey' for pagination and the structure of the JSON response, which contains app details and pagination metadata.
```json
{
"openapi": "3.0.3",
"info": {
"title": "Appetize API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.appetize.io/v1"
}
],
"security": [
{
"apiToken": []
}
],
"components": {
"securitySchemes": {
"apiToken": {
"type": "apiKey",
"in": "header",
"name": "X-API-KEY",
"description": "Use an API token for authentication via X-API-KEY header"
}
}
},
"paths": {
"/apps": {
"get": {
"summary": "Get All Apps - Paginated",
"tags": [
"Listing Apps"
],
"description": "Retrieves information about all apps int he account, with associated metadata.\n\n_Recommended approach for retrieving all apps._\n",
"parameters": [
{
"in": "query",
"name": "nextKey",
"schema": {
"type": "string"
},
"description": "If results are truncated due to too many apps, response will include `hasMore:true` and a `nextKey` to retrieve the next page. \nPass the nextKey value as query parameter into the GET request to retrieve the next batch of apps.\n"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"hasMore": {
"type": "boolean",
"description": "Indicates if results have been truncated"
},
"nextKey": {
"type": "string",
"description": "Query parameter for the next batch of results"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"publicKey": {
"type": "string",
"description": "The publicKey for the app."
},
"created": {
"type": "string",
"format": "date-time",
"description": "The date and time when the app was created."
},
"updated": {
"type": "string",
"format": "date-time",
"description": "The date and time when the app was last updated."
},
"platform": {
"type": "string",
"description": "The platform of the app (ios or android)."
},
"bundle": {
"type": "string",
"description": "The app identifier of the app."
},
"name": {
"type": "string",
"description": "The name of the app."
},
"appDisplayName": {
"type": "string",
"description": "The display name of the app."
},
"appVersionCode": {
"type": "string",
"description": "The version code of the app."
},
"appVersionName": {
"type": "string",
"description": "The version name of the app."
},
"versionCode": {
"type": "integer",
"description": "The incremental version code, managed by Appetize, for the app."
},
"iconUrl": {
"type": "string",
"format": "uri",
"description": "The URL to the app's icon image."
}
}
}
}
}
}
}
}
}
}
}
}
}
}
```