Skip to content
Discussion options

You must be logged in to vote

Mixing simple form fields with file parts in a multipart request is supported. The method needs [Multipart] and every non-file parameter becomes a form field. The common mistake that produces blank fields is sending int/string parameters that the server cannot read as form fields, or not aliasing them to the exact field names the API expects.

For your curl (scan_type=all plus a file field named file):

[Multipart]
[Post("/api/v2/quick-scan/file")]
Task<ApiResult> QuickScan(
    [AliasAs("scan_type")] string scanType,
    [AliasAs("file")] StreamPart file);

Call it:

using var stream = File.OpenRead("Ziv.pdf");
await api.QuickScan("all", new StreamPart(stream, "Ziv.pdf", "application/pdf"));

S…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by glennawatson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants