Submit Form Data using RestSharp RRS feed

  • Question

  • I am trying to emulate the following curl command in c# using RestSharp.

    curl URL -F "login=samplelogin" -F "key=password"

    I am using the following c# code to format the request:

                // Configure Request

                RestRequest request = new RestRequest(resource, Method.POST);
                request.AddParameter("login", context.Control.CourtLogin, ParameterType.RequestBody);
                request.AddParameter("Key", context.Control.CourtPassword, ParameterType.RequestBody);

                request.AddHeader("Content-Type", "multipart/form-data");

    The client endpoint just returns login failure.  When I read the documentation for AddParameter on the RestRequest class.  It states you can only have key value pair with parameter type = RequestBody.   

    Does anyone have any ideas on how to get multiple form data key value pairs in a RestSharp client request?  Or how to duplicate the -F curl option using RestSharp?

    Thanks in advance!


    • Edited by JL11111 Wednesday, August 12, 2020 2:17 PM
    • Moved by CoolDadTx Thursday, August 13, 2020 1:43 PM Third Party Product
    Wednesday, August 12, 2020 2:13 PM

All replies