Question: Multipart form-data with Refit

See original GitHub issue

Hi,

I have a dotnet core web api endpoint that takes a strongly typed object as argument

public class FileUploadArgs
{   
    public int Id { get; set; }
    public string Email { get; set; }
    public IFormFileCollection Files { get; set; }
}

Endpoint signature:

[HttpPost, Route("upload")]
public async Task<IActionResult> UploadFile([FromForm] FileUploadArgs args)

I call this method via HTTPIE on shell as

$ http -f POST localhost:5000/api/v3/file/upload Id='123456' Email='test@test.com' 'Files'@/mnt/c/apiloadtest/2124545.pdf x-api-key:'{my-api-key}'

I want to write this endpoint in Refit interface in another app that will send files to this endpoint along with other form data.

I’m not sure how this can be be written in Refit. Any help would be appreciated!

Thanks!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:19
  • Comments:8

github_iconTop GitHub Comments

3reactions
xiaolei000129commented, Nov 1, 2022

image

I successfully fulfilled the requirement

1reaction
xiaolei000129commented, Oct 31, 2022

Mm-hmm. Ooooooo the baby is already crying

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Multipart Content with refit
It's an old question, but maybe it could help others. I wasn't able to use StreamPart either since the file size received on...
Read more >
How can I compose a multipart/form-data request?
I'm trying to integrate Kraken.io into our org so I can have Salesforce queue up image optimization jobs that our employees upload. Kraken.io ......
Read more >
Multipart Form Post in C# - Brian Grinstead
I first tried using the WebClient UploadFile method, but it didn't fit my needs because I wanted to upload form values (id, filename,...
Read more >
Question: How to upload a file using HTTP POST Form-Data?
I am looking to upload multipart for data, including a file, with an HTTP post. When implementing your example I do receive errors...
Read more >
C# – Multipart Content with refit
I am using multipart with Refit. I try to upload profile picture for my service the code generated from postman is looking like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found