SDK Overview
9 min
device park sdk is a java and node js client library for integrating mobile device reservation and test session management into test runners, ci pipelines and internal testing tools the sdk provides typed methods for finding devices, reserving a device, creating sessions, collecting session artifacts and managing apk or ipa files key concepts device a device represents a physical android or ios device visible to your account device information includes serial, model, manufacturer, platform version and current state listing a device does not reserve it the device becomes dedicated to your test flow after device park creates an allocation device pool a pool is a managed group of devices use a pool when the test can run on any suitable device in that group use a device serial when the test must run on one exact device use a pool when availability is more important than selecting a particular serial allocation an allocation is a temporary device reservation it connects the device selection step to the session lifecycle an allocation can be created with an exact device serial a device pool id platform, version, manufacturer or model criteria if no matching device is immediately available, the allocation may wait in a queue the returned queue position and assigned device serial describe its current state an active allocation can be reused for multiple sessions stop the current session, keep the allocation active and start the next session with the same allocationid release the allocation only after the final session session a session represents one test interaction period on the allocated device it stores the session state, allocation relationship, device details, appium version, recording settings and timestamps the sdk creates and manages the device park session your appium client or test framework sends the actual automation commands application an application represents an apk or ipa stored by device park upload returns a stable filekey , version and revision information keep filekey as the application identifier download urls can expire and should not be stored as permanent identifiers device selection choose the allocation target based on the test requirement requirement selection test one known device use serial test any device from a managed group use devicepoolid test any matching operating system use platform and platformversion restrict by hardware add manufacturer or model more specific criteria reduce the number of matching devices and can increase queue time allocation and session lifecycle flowchart td select\["select a device or pool"] > allocate\["create allocation"] allocate > assigned{"device assigned?"} assigned no > wait\["inspect the same allocation"] wait > assigned assigned yes > start\["start session"] start > test\["run appium test"] test > stop\["stop session"] stop > more{"another session needed?"} more yes > start more no > artifacts\["collect logs and recordings"] artifacts > release\["release allocation"] session stop and allocation release are different operations stopping a session ends one interaction period releasing an allocation returns the reserved device to device park do not release the allocation while another session still needs it authentication and client lifetime the sdk uses oauth2 client credentials credentials are supplied when creating deviceparkapiclient the client retrieves a token when required, caches it in memory and renews it before expiration reuse one client during the test run so token and transport state remain available close the client when the test run finishes java supports try with resources; node js uses await client close() pagination and nullable results list methods return pagedto\<t> records are available in data , while page , size , totalpages and totalelements describe pagination some fields are temporarily null allocation deviceserial while waiting for assignment session enddate while the session is active recording urls while video processing is incomplete check required identifiers before passing them to the next sdk method next steps run your first sdk flow /getting started/get startedrun the complete node js example /examples/node quickstartrun the complete java example /examples/java quickstartinstall the sdk /getting started/installationlearn how authentication works /getting started/authentication
