Here is my Curl request:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://api-cloud.browserstack.com/app-automate/sessions/22dbfb187486090d974a11ac91t65722988e0705.json"
This is the Response I received:
{
"automation_session": {
"name": "login_test",
"duration": 39,
"os": "android",
"os_version": "9.0",
"browser_version": "app",
"browser": null,
"device": "OnePlus 6T",
"status": "passed",
"hashed_id": "22dbfb187486090d974a11ac91t65722988e0705",
"reason": "CLIENT_STOPPED_SESSION",
"build_name": "SampleBuild",
"project_name": "SampleProject",
"logs:" "https://app-automate.browserstack.com/builds/g0726012b6rb0a4c79122d6048c7b8767677ad61/sessions/22dbfb187486090d974a11ac91t65722988e0705/logs",
"public_url": "https://app-automate.browserstack.com/builds/g0726012b6rb0a4c79122d6048c7b8767677ad61/sessions/22dbfb187486090d974a11ac91t65722988e0705?auth_token=9876563e667cd765467e6fea5a834121e568be899505699b",
"app_details": {
"app_url": "bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3",
"app_name": "com.sample.loginapplication",
"app_version": "1.0",
"app_custom_id": "LoginApp",
"uploaded_at": "2020-09-09T18:14:20.000Z"
}
}
}
I want to extract the public_url value and store it in a JavaScript variable for display.
Alternatively, can you suggest if this can be achieved with Groovy Script for Pipeline?