QuickStart
A quick example showcasing the usage
import axios from "axios"
(async () => {
// Configuration
const API_URL = '';
const config = {
headers: {
'X-Api-Key-Id': 'your-apiKey-uuid',
'X-Api-Key': 'your-apiKey-secret',
'Content-Type': 'application/json'
}
};
try {
// Create a random fingerprint (OPTIONAL)
const fingerprintResponse = await axios.post(
`${API_URL}/api/v1/fingerprints/random`,
{
enviornmentUUID: 'your-enviornment-uuid'
},
config
);
const fingerprintUUID = fingerprintResponse.data.fingerprintUUID;
// Create Session
config.headers["X-Fingerprint-Secret"] = fingerprintResponse.data.fingerprintSecret
const sessionResponse = await axios.post(
`${API_URL}/api/v1/sessions`,
{
fingerprintUUID,
leaseTime: 10, // 10 minutes
isVncEnabled: false,
driver: 'api'
},
config
);
const sessionUUID = sessionResponse.data.sessionUUID;
// Do some stuff
console.log('Session created:', sessionUUID);
// End Session
await axios.delete(
`${API_URL}/api/v1/sessions/${sessionUUID}`,
config
);
console.log('Session ended');
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
})();
Last updated