How to install app programmatically in Hololens 2 with API?

Kirk 1 Reputation point
2022-09-14T14:42:36.987+00:00

Hello,

I'm interested in getting some help with installing an application programmatically with a HoloLens 2. I have a project setup that's been able to successfully interface with my HoloLens 2. I'm able to get OS information, status of the headset, thermals, and more. Unfortunately, I've been unable to successfully send the .appxbundle to install on my device. I believe that I may be sending the POST request incorrectly. Any help is greatly appreciated!

Here is a portion of my Python script:

response = requests.post('https://' + self.ip + '/api/app/packagemanager/package?package=' + file_name,
files=multipart_form_data, auth=(self.username, self.password), verify=True)

Here's a link reference with Windows Device Portal docs: https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/device-portal-api-reference

HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
396 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Zuocheng Wang - MSFT 3,091 Reputation points Microsoft Vendor
    2022-09-22T05:57:58.57+00:00

    Hello, Welcome to Microsoft Q&A,

    I'm not familiar with Python so I use RESTful testing tool - Postman to test, below is my configuration, hope it will be useful to you.

    1. Refer Windows Device Portal overview - UWP applications | Microsoft Learn to select the connection method and the corresponding IP and port, I am using a USB connection.
    2. Params: Add "KEY: package, VALUE: [pacakageName]"
    3. Authorization: Select Basic Auth
    4. Body: Select form-data, select the KEY type as File, and VALUE as the package to be uploaded.
      ----
      If the response is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    2 people found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.