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 / Send an image to Azure...
Power Automate
Unanswered

Send an image to Azure DevOps - HTTP request PATCH

(0) ShareShare
ReportReport
Posted on by 54

Hello, 

 

I'm trying to send an image that is stored in a Datverse table to a work item to Azure DevOps. The step HTTP request (PATCH) is having errors. I've tried almost everything. Any idea what I can do? The following screenshots are from my flow: 

 

aorro93_0-1678347432577.png

aorro93_1-1678347539626.png

 

aorro93_2-1678347596119.png

 Thanks

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,

     

    Looking at your screenshot I notice two things in the Patch request. The name property is missing within the attributes property. And it also looks like there are trailing white space characters in the Content-Type Header key and value fields. Can make sure you move any trailing white spaces over there?

     

    namefile.png

     

    If it helps here is an example which I recently used (tested and should work)

     

    Sample payload

    [
     {
     "op": "add",
     "path": "/relations/-",
     "value": {
     "rel": "AttachedFile",
     "url": "https://dev.azure.com/<orgname>/_apis/wit/attachments/d828a9ef-fc71-430a-94a6-72dc754dc323?fileName=<filename>.docx",
     "attributes": {
     "comment": "Bug upload details",
     "name":"<filename>.docx"
     }
     }
     }
    ]

     

    namefile02.png

  • aorro93 Profile Picture
    54 on at

    Thanks for your answer. I deleted the space in the Content-Type and added the field "name" (any name is possible?). 

    I still having an error: 

     

    The request indicated a Content-Type of "application/json-parse+json" for method type "PATCH" which is not supported. Valid content types for this method are: application/json-patch+json.

    Details: {"$id":"1","innerException":null,"message":"The request indicated a Content-Type of \"application/json-parse+json\" for method type \"PATCH\" which is not supported. Valid content types for this method are: application/json-patch+json.","typeName":"Microsoft.VisualStudio.Services.WebApi.VssRequestContentTypeNotSupportedException, Microsoft.VisualStudio.Services.WebApi","typeKey":"VssRequestContentTypeNotSupportedException","errorCode":0,"eventId":3000}

  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,

     

    Can you try the same Uri as me, which is a relative url not an absolute one?

    Replace the <yourid> by your dynamic content field, btw

    _apis/wit/workitems/<yourid>/?api-version=7.1-preview

     

  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,


    Oh and I see you made a typo in the header as well. It is patch, not parse 😁

     

    Your content-type header value

    application/json-parse+json

     

    The content-type value should be:

    application/json-patch+json

     

  • aorro93 Profile Picture
    54 on at

    Same error is shown

  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,

     

    See my last reply. Did you check your parse typo in the header?

  • aorro93 Profile Picture
    54 on at

    Oh! that's true, thanks! I have a new error, is it possible that the image of Dataverse table have to be transform to base64? 

     

    You must pass a valid patch document in the body of the request.

    Details: {"$id":"1","innerException":null,"message":"You must pass a valid patch document in the body of the request.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}

  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,

     

    I haven't tested that specific scenario before. 

     

    Looking at the screenshot of your opening post I would say you are missing something in the POST request (the upload part of your flow). I see you haven't included the file content in the Body (Cuerpo) field? 

     

    Have a look at some examples in the Attachments - Create POST doc.

     

    filecontent_missing.png

  • aorro93 Profile Picture
    54 on at

    Yes, but I added, I just forgot it when the screenshot. 

    Right now, I've changed this part: 

    aorro93_1-1678355746026.png

     

    Reading the documentation, it's not clear for me if I only have to use the step POST to add the image?

     

    Thank you!

     

     

     

  • Expiscornovus Profile Picture
    33,183 Most Valuable Professional on at

    Hi @aorro93,

     

    Is that content base64 already, can you check in the flow run inputs section of that request? If not, can you turn it into base64 by using the base64 function in an expression?

     

    Btw, the generic approach is

    - Use a POST request to upload the file

    - Use a PATCH request to add a link between the work item and the uploaded file

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 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard