web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add multiple Base64 to...
Power Automate
Unanswered

Add multiple Base64 to HTTP request

(0) ShareShare
ReportReport
Posted on by 205
Hello, colleagues.
 
I want to configure PAD to have ChatGPT analyze multiple images in one “Invoke web service” request.
 
I found the instruction “Uploading Base64 encoded images” https://platform.openai.com/docs/guides/vision#uploading-base64-encoded-images.
How can I make multiple image inputs into this request if the exact number of files is not known in advance?
 
 
For example.
This request works with one image:
 
{
“model": “gpt-4o-mini”,
“messages": [
{
“role": { “user”,
{ “content”: [
{
“type": ‘text’,
{ “text”: “What is in these images?”
},
{
“type": ‘image_url’,
{ “image_url”: {
{ “url”: “data:image/jpeg;base64,%Base64_Image1%”
}
}
]
}
]
}
 
 
How do I add more files to this query to fulfill it?
 
{
{ “model”: “gpt-4o-mini”,
“messages": [
{
“role": { “user”,
{ “content”: [
{
“type": ‘text’,
{ “text”: “What is in these images?”
},
{
“type": ‘image_url’,
{ “image_url”: {
{ “url”: “data:image/jpeg;base64,%Base64_Image1%”
}
},
{
“type": ‘image_url’,
{ “image_url”: {
{ “url”: “data:image/jpeg;base64,%Base64_Image2%”
}
}
... 
]
}
]
}
 
 
The second problem is that between each set, you have to put a comma, but at the end of the last set, you don't need a comma.
 
I would be grateful if you could help me with my problem in PAD.
 
 
 
 
I will give a like + mark the question as solved.
 
 
I have the same question (0)
  • Verified answer
    absentia8 Profile Picture
    205 on at
    Here's an off-the-shelf solution that cost me $10 on a freelance exchange :)
     
    Folder.GetSubfolders Folder: $'''C:\\Users\\User\\Desktop\\img''' FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders
    Variables.CreateNewList List=> imagesArray
    LOOP FOREACH CurrentItem_Folder IN Folders
        Folder.GetFiles Folder: CurrentItem_Folder FileFilter: $'''*.png;*.jpg''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
        LOOP FOREACH CurrentItem_File IN Files
            File.ConvertToBase64 File: CurrentItem_File Base64Text=> Base64_Image
            Variables.AddItemToList Item: Base64_Image List: imagesArray
        END
    END
    SET requestBody TO $'''{
      \"model\": \"gpt-4o-mini\",
      \"messages\": [
        {
          \"role\": \"user\",
          \"content\": [
            {
              \"type\": \"text\",
              \"text\": \"What is in these images?\"
            }'''
    LOOP FOREACH CurrentItem IN imagesArray
        SET ImageItem TO $''',
    {
      \"type\": \"image_url\",
      \"image_url\": {
        \"url\": \"data:image/jpeg;base64,%CurrentItem%\"
      }
    }'''
        Text.AppendLine Text: requestBody LineToAppend: ImageItem Result=> requestBody
    END
    SET EndItem TO $'''      ]
        }
      ]
    }'''
    Text.AppendLine Text: requestBody LineToAppend: EndItem Result=> requestBody
    Web.InvokeWebService.InvokeWebServicePost Url: $'''https://api.openai.com/v1/chat/completions''' Accept: $'''application/json''' ContentType: $'''application/json''' CustomHeaders: $'''Authorization: Bearer sk-proj-YWg7oUWxbvPXxt6jKp_u-6vk1o3RkGZCSWPp4r-x9Qco3J6W4YuRRCIuhHALt6O5nWmo9jNuoExXFTvzFodL0iqvvfUA''' RequestBody: requestBody ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False UploadType: Web.UploadType.FilePath TrimRequestBody: True ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard