Skip to main content
All CollectionsUnpublished OP
Uploading HAR Files via API
Uploading HAR Files via API
Luiza Gircoveanu avatar
Written by Luiza Gircoveanu
Updated over a week ago

Overview

LiveConnect allows users to upload HAR files which can be extracted from a variety of sources. To support integrating the HAR file with CI/CD processes and automating the validation of web and mobile testing, this guide will walk you through how to integrate with ObservePoint's API.

Note: Uploading HAR files might not be a feature you have access to, reach out to your Customer Success Manager or Account Executive to verify if you have access.

Downloading HAR Files

HAR files can be accessed in a variety of ways. Most easily is done through the browser, as described here for websites and here for mobile apps. You can also export them through Charles Proxy and some device farm tools including, but not limited to SauceLabs, BrowserStack, and BitBar.

Note: These device farms only allow exports available for Web.

Uploading HAR Files

The steps below will walk you through the API call syntax required to upload HAR files programatically. We'll use Postman, but once successfully tested, you can convert your Postman request to a code snippet seamlessly.

1. Start by created a new GET request with the following endpoint: ​

https://api.observepoint.com/v2/manual-journeys/{your deviceID goes here}/har-runs/s3-post-policy

Note: You'll need to apply your own device ID. You can find it by editing the device and looking at the URL. e.g. https://app.observepoint.com/deviceProfile/mobile/640

The response from this request will provide you with the necessary authorization credentials to upload your HAR file to a secure Amazon S3 storage. It should look like this:

Note: the objectKeyPrefix, uploadUrl, and formData variables will be required for the next steps.

2. Next, upload file(s) to S3 by POST to the AWS location.

Note: The 7 keys from formData in the previous request response and also "objectKeyPrefix" are in the payload form-data as well as the HAR files selected.

Each HAR file should have a unique file name, otherwise new uploads with the same name will overwrite existing files in S3

3. Finally, instruct ObservePoint to process the HAR file(s) with the below request with the following payload.

https://api.observepoint.com/v2/manual-journeys/{your deviceID goes here}/har-runs

cURL Examples:

//Step 1
curl --location --request GET 'https://api.observepoint.com/v2/manual-journeys/159/har-runs/s3-post-policy' \
--header 'Content-Type: application/json' \
--header 'Authorization: api_key {Your ObservePoint API Key}'

//Step 2
curl --location --request POST 'https://prod-customer-uploads-bucket.s3.amazonaws.com' \
--header 'Content-Type: multipart/form-data' \
--form 'X-Amz-Algorithm="AWS4-HMAC-SHA256"' \
--form 'tagging="<Tagging><TagSet><Tag><Key>orphaned_expire_after0</Key><Value>1_day</Value></Tag></TagSet></Tagging>"' \
--form 'Policy="{take from response to step 1}"' \
--form 'acl="private"' \
--form 'X-Amz-Date="{take from response to step 1}"' \
--form 'key="uploaded_files/users/48/MikesNEWtest21oct"' \
--form 'X-Amz-Credential="{take from response to step 1}""' \
--form 'file=@"/C:/Users/Mike Fong/Downloads/www.alo.har"'

//Step 3
curl --location --request POST 'https://api.observepoint.com/v2/manual-journeys/159/har-runs' \
--header 'Content-Type: application/json' \
--header 'Authorization: api_key {Your ObservePoint API Key}' \
--data-raw '{
"journeyRunName": "demo",
"harFiles": [
{
"s3Key": "uploaded_files/users/48/MikesNEWtest21oct",
"name": "www.alo.har"
}
]
}'
Did this answer your question?