-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support -F
/ --form
in the Multipart parameters
#1744
Comments
-f
/ --form
in the Multipart parameters-F
/ --form
in the Multipart parameters
Can you explain what that |
In the Postman, the current selection is a There's also a Code snippet view; for RestSharp the generated code (that doesn't work) is as the following (sensitive data removed): var client = new RestClient("https://SENSITIVE.freshdesk.com/api/v2/tickets");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("Authorization", "Basic SENSITIVE");
request.AddHeader("Cookie", "_x_w=5_2");
request.AlwaysMultipartFormData = true;
request.AddParameter("email", "a@a.com");
request.AddParameter("subject", "Test ticket");
request.AddParameter("description", "Test ticket");
request.AddParameter("status", "2");
request.AddParameter("priority", "1");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content); On the
|
Here's what I did: var ticket = new {
Email = "test@acme.org",
Description = "description",
Subject = "subject",
Status = "status",
Priority = "low"
};
var client = new RestClient("https://enqvvdg27q3o.x.pipedream.net/");
var request = new RestRequest("tickets", Method.Post)
.AddFile("test.cs", "test.txt")
.AddParameter("email", ticket.Email)
.AddParameter("description", ticket.Description)
.AddParameter("subject", ticket.Subject)
.AddParameter("status", ticket.Status)
.AddParameter("priority", ticket.Priority);
var rs = await client.ExecuteAsync(request); And that's how the request looks like: It's hard for me to guess what exactly FreshDesk is unhappy about as the request looks completely legit. |
I know what is the issue with FreshDesk API and it has nothing to do with supporting multipart form data parameters as they are supported for many years. |
I'd like to create a ticket with attachment in the Freshdesk API [API reference].
Example of the cURL for the request:
When the following RestSharp code is used:
...Then it results with the 400 BadRequest with the following response:
The above works fine in Postman:
The request is to provide a proper
ParameterType
to handle the above scenario.The text was updated successfully, but these errors were encountered: