简体   繁体   中英

Flurl post data

I have a processmaker web entry form and want to post data to it.
request should be like this
在此处输入图像描述
My code is like this:

var ticket = "https://xxx.yyyy.zzz"
            .AppendPathSegment("/sysworkflow/en/neoclassic/3498535156074b324397243068854136/8211975096074b37b513794064716441Post.php")
            .PostJsonAsync(new
            {
                form = new
                {
                    contract_expert = "xxxxx",
                    vendor_id = "1111",
                    vendor_name = "aaa",
                    contract_number = "bbB",
                    contract_title = "ccc"
                }
            })
            .ReceiveString().Result;

The problem is when I call this data with postman data will sit in their place but with flurl everything is empty after submit data. btw postman content-type is multipart/form-data

multipart/form-data ,= JSON, so don't use PostJsonAsync . Use PostMultipartAsync . This is documented here . Here's the relevant change to what you have:

.PostMultipartAsync(mp => mp.AddStringParts(new
{
    contract_expert = "xxxxx",
    vendor_id = "1111",
    vendor_name = "aaa",
    contract_number = "bbB",
    contract_title = "ccc"
}))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM