Hello @Shiva Sadayan,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Yes, it is possible to receive both a JSON payload and a file attachment in Azure Logic Apps. You can achieve this by using a combination of HTTP triggers and actions.
- First set up an HTTP trigger in your Logic App that listens for incoming requests containing JSON. The JSON payload you provided can be processed using the built-in functions of Logic Apps.
- To handle form-data that includes a file attachment, you can specify the content type as multipart/form-data. In the HTTP request body, you can include a JSON object that specifies the $content-type and $multipart attributes, allowing you to handle the file upload alongside the JSON data.
- After receiving the file attachment, you can use the Azure Blob Storage connector to upload the file to your storage account and you will need to specify the blob name and content in the action that creates the blob.
Here’s a brief example of how the HTTP request body might look for receiving both JSON and file data:
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"body": "{\"transactionid\":\"12345\",\"transactiondate\":\"2025-01-01\",\"customerId\":\"CUST001\",\"branch\":\"Branch001\"}",
"headers": {
"Content-Disposition": "form-data; name=\"jsonPayload\""
}
},
{
"body": "<file-content>",
"headers": {
"Content-Disposition": "form-data; name=\"file\"; filename=\"attachment.csv\""
}
}
]
}
You can then process the JSON data and upload the file to your storage account using the appropriate actions in your Logic App.
Also, for your better understanding please refer the document to Add an action to create a blob for email body and to know Content with multipart/form-data type.
I hope the above provided information helps in understanding better and solve your issue, if you have any further queries or concerns, please feel free to reach out to us.