Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Logic Apps: Unable to Attach File to Azure DevOps Work Item via API - "Body parameters are not specified." #1236

Open
pr081578 opened this issue Nov 15, 2024 · 4 comments
Labels

Comments

@pr081578
Copy link

pr081578 commented Nov 15, 2024

Describe the Bug with repro steps

Set Up Logic App:

Add an action to retrieve an email attachment (Get Attachment from Office 365, for example).

Ensure the attachment content is available as a base64 string.

Add a Compose Action (Optional):

Use the expression base64ToBinary() to decode the attachment content into binary format:

base64ToBinary(outputs('Get_Attachment')?['body'])

Add HTTP Action to Upload the Attachment:

Method: POST

URI:

https://dev.azure.com/{organization}/{project}/_apis/wit/attachments?fileName={fileName}&api-version=6.0

Headers:

{

"Content-Type": "application/octet-stream",

"Authorization": "Bearer {PersonalAccessToken}"

}

Body: Pass the binary output from the Compose step or the base64 content directly.

Run the Logic App:

Trigger the Logic App to upload an attachment to Azure DevOps.

Observe the response from the Azure DevOps API.

What type of Logic App Is this happening in?

Consumption (Portal)

Which operating system are you using?

MacOS

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
  "status": 400,
  "message": "Body parameters are not specified.\r\nclientRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "error": {
    "message": "Body parameters are not specified."
  },
  "source": "vsts-ncus.azconn-ncus-001.p.azurewebsites.net"
}

Screenshots or Videos

No response

Browser

Safari

Additional context

No response

@hartra344 hartra344 transferred this issue from Azure/LogicAppsUX Nov 15, 2024
Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Dec 31, 2024
@arnaudluti
Copy link

Same issue here, here is the input send to the "upload attachment" task,
{ "method": "post", "queries": { "account": "[redacted]" }, "path": "/httprequest", "host": { "connection": { "referenceName": "visualstudioteamservices" } }, "body": { "Method": "POST", "Uri": "[redacted-teamname]/_apis/wit/attachments?uploadType=Simple&fileName=somerandomfile.pdf&api-version=7.1-preview.3", "Headers": { "content-type": "application/pdf" }, "Body": { "$content-type": "application/octet-stream", "$content": "SlZCRVJpMHhMalFLSm[redactedb64]=" }, "IsBase64": true } }
and here is the response,
{ "status": 400, "message": "Body parameters are not specified.\r\nclientRequestId: e4df9a7e-debd-465a-98f4-db9f9b0313fa", "error": { "message": "Body parameters are not specified." }, "source": "vsts-fc.azconn-fc-001.p.azurewebsites.net" }

@github-actions github-actions bot removed the stale label Jan 9, 2025
@arnaudluti
Copy link

Hello @pr081578

Could you share the way you upload the file to AzDo?

I finally found that the body should be simply set with the output values of the "retrieve attachments" task, i though that you looked at this post that says to put the "contentBytes" between binary() brackets for the upload task, it's not necessary and causes this problem.

Now my upload task looks like:

{ "type": "ApiConnection", "inputs": { "host": { "connection": { "referenceName": "visualstudioteamservices" } }, "method": "post", "body": { "Method": "POST", "Uri": "@{body('Parse_JSON')?['fields']?['System.TeamProject']}/_apis/wit/attachments?uploadType=Simple&fileName=@{body('Retrieve_attachments')?['name']}&api-version=7.1-preview.3", "Headers": { "content-type": "@{body('Parse_JSON_response_from_Retrieve_attachments_step_')?['contentType']}" }, "Body": "@body('Parse_JSON_response_from_Retrieve_attachments_step_')?['contentBytes']", "IsBase64": true }, "path": "/httprequest", "queries": { "account": "redacted" } }, "runAfter": { "Parse_JSON_response_from_Retrieve_attachments_step_": [ "SUCCEEDED" ] } }

Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants