cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ausben
Level: Powered On

Android http post body format from powerapps different from web and iOS client

I followed Paul Culmsee's how to upload photos using flow and have a custom connector for flow which allows powerapps to call it using a http post trigger.  When I look at the iOS and web client versions of powerapps, the http call has a body format like this

 

"body": {
            "$content-type": "multipart/form-data; boundary=\"969e7c17-5270-bc93-a78f-b9a71443f19c\"",
            "$content": "LS05NjllN2MxNy01M<--content removed--> =",
            "$multipart": [{
                "headers": {
                    "Content-Disposition": "form-data; name=\"file\"; filename=\"file_95de420d-d6e5-11eb-9652-ada88cafc5fd.jpg\"",
                    "Content-Type": "image/jpeg"
                },
                "body": {
                    "$content-type": "image/jpeg",
                    "$content": "/9j/4AAQSkZJRgABAQAASABIAAD/<--content removed-->"
                }
            }]
        }

 

where the large text above is the base64 encoded string for the file content.

 

But in the powerapps android client, the resulting http post format looks like

 

"body": {
            "$content-type": "application/octet-stream",
            "$content": "TFMwMlpHSTRNamMzWUUVCQVFFJUT281M2p6bzdNLy9aRFFvdExUWmtZamd5TnpkakxUUTFZV0l0TldNNVpDMWxPREEwTFdRMFlURTBNVFZoTkRJeU55MHREUW89<--content-removed-->"
        }

 

Where the large text above is a base64 encoded string which when decoded you can see is comprimised of a few things (see below).

 

 

Is there a way to get Android powerapps to call the http post method using the same format?

5 REPLIES 5
Ausben
Level: Powered On

Re: Android http post body format from powerapps different from web and iOS client

Edit: it’s not just android. It seems that different powerapps clients produce different formatted http post body elements. What is the way to handle this..?
Community Support Team
Community Support Team

Re: Android http post body format from powerapps different from web and iOS client

Hi @Ausben,

 

Have you also checked the following article?

http://johnliu.net/blog/2017/5/taking-a-picture-with-powerapps-and-sending-to-sharepoint-with-help-o...

 

Which also talks about the same issue, you may follow the steps there and try again.

 

Your issue here should be related with the Open API file, specially for the upload file definition part.

Would you please share your OpenAPI file for further analyze?

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ausben
Level: Powered On

Re: Android http post body format from powerapps different from web and iOS client

Hi Michael, thank you for the link I will have a look at the approach you sent through. Please find the swagger definition below. If you see something that I could fix up that would be very much appreciated. { "swagger": "2.0", "info": { "description": "Photo To SPO Demo", "version": "1.0.0", "title": "Photo To SPO Demo", "termsOfService": "https://prod-49.westus.logic.azure.com/terms-of-service", "contact": { "name": "", "url": "https://www.linkedin.com/in//", "email": "Ben.J.Williams@conocophillips.com" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, "host": "prod-49.westus.logic.azure.com:443", "basePath": "/workflows", "schemes": [ "https" ], "consumes": [], "produces": [], "paths": { "/97e56a9859f84d3485b87247db3d772c/triggers/manual/paths/invoke": { "post": { "summary": "Post Photo", "operationId": "PostPhoto", "produces": [], "responses": { "202": { "description": "Accepted" } }, "consumes": ["multipart/form-data"], "parameters": [{ "name": "content-type", "in": "header", "description": "", "required": false, "type": "string", "x-ms-visibility": "internal", "default": "" }, { "name": "api-version", "in": "query", "type": "string", "description": "", "default": "2016-06-01", "required": true, "x-ms-visibility": "internal" }, { "name": "sp", "in": "query", "type": "string", "description": "", "default": "/triggers/manual/run", "required": true, "x-ms-visibility": "internal" }, { "name": "sv", "in": "query", "type": "string", "description": "", "default": "1.0", "required": true, "x-ms-visibility": "internal" }, { "name": "sig", "in": "query", "type": "string", "description": "", "default": "ks3_utL-tMz1Tn5TxAl-Ag", "required": true, "x-ms-visibility": "internal" }, { "name": "filename", "in": "query", "type": "string", "description": "filename of the uploaded file", "required": true }, { "name": "file", "in": "formData", "type": "file", "description": "file to upload", "required": true }, { "name": "latitude", "in": "query", "type": "string", "description": "Latitude of the photo", "required": false }, { "name": "longitude", "in": "query", "type": "string", "description": "Longitude of the photo", "required": false }, { "name": "referenceId", "in": "query", "type": "string", "description": "Reference to sharepoint list item id", "required": false }], "description": "Post Photo" } } }, "definitions": {}, "parameters": {}, "responses": {}, "securityDefinitions": {}, "security": [], "tags": [] }
Highlighted
Ausben
Level: Powered On

Re: Android http post body format from powerapps different from web and iOS client

Hi Michael, I tried out John Lui's solution and while it works for images captured by the camera control, the take picture control creates a different type of data. When the powerapps flow trigger recieves it as blob:http://localhost:1094/2e18c34a-00f1-4757-986e-aed8926b2397 and as we would expect the dataURITobinary call fails as the flow action isn't able to convert this to the format that the sharepoint site wants for the filecontent. Using this method means users won't have an option to upload photos which have been previously collected on their devices in a higher resolution. If I use the swagger defined flow webservice that Paul Culmsee describes I can get a user experience where they can choose to upload either photo (but they must be using the iphone powerapp app). This isn't going to work for a BOYD workplace. Thank you for the suggestion. If you have some more ideas about how I might handle the photos from both control types please mention them becase my clients are excited to have some solutions with photos.
Community Support Team
Community Support Team

Re: Android http post body format from powerapps different from web and iOS client

Hi @Ausben,

 

Thanks for the update.

Currently I have no idea, I will take some time to perform the test, and share you the results.

There might be some time delay.

Appreciate your patience and understanding.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,422)