Skip to main content

Upload custom contacts in App Automate

App Automate has a preloaded contact files on BrowserStack-hosted devices to test scenarios that require access to contacts from the device.

Apart from preloaded contact list, you can also upload your contact list in App Automate.

The contact list you upload on iOS or Android devices is stored in the default Contacts app of the devices.

In this guide, you’ll learn how to:

  1. Upload your custom contacts file to BrowserStack

  2. Set the uploadMedia parameter when executing your build

Upload your custom contacts file to BrowserStack

Note: Before uploading your custom contacts file, note the following points:
  • The contact file is in the vCard (.vcf) format.
  • The maximum file size to upload is 2 MB.
  • The maximum number of custom contacts to upload on a device is 50.

Run the following upload media cURL command to upload your custom contacts (.vcf) file to BrowserStack servers:

    curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
    -X POST "https://api-cloud.browserstack.com/app-automate/upload-media" \
    -F "file=@/path/to/contacts/file.vcf" \
    -F "custom_id=SampleContacts"

A sample response for the given cURL command is as follows. It returns the value of the media_url parameter.

{
    "media_url": "media://90c7a8h8dc82308108734e9a46c24d8f01de12881",
    "custom_id": "SampleContacts"
}

Set uploadMedia parameter when executing Espresso build

In the execute build cURL command, set the uploadMedia parameter to the value of the media_url parameter returned in the API response to upload your custom contacts onto the BrowserStack hosted device for testing.

The following sample cURL command shows the parameter used to upload custom contacts file on Samsung Galaxy S8 with Android OS v7.0:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build"
\ -d '{"uploadMedia": ["media://90c7a8h8dc82308108734e9a46c24d8f01de12881"],
"devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d",
"testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}'
\ -H "Content-Type: application/json"

Need some help?

If you need any help with this feature, get in touch with us.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert