Failing to start Process from C#

I have created a new Process to create a DOCX from a DOCX template.

I can run the process (successfully) in the My Account Website, and I have copied the URL to the process from the REST API tab in the site.

Below is my code, when I call this, my response.Content is blank, and the job is not executed (it does not appear in the list of executions in the web site.

What am I doing wrong?

    var client = new RestClient("URLTOPROCESSREMOVED");
    var request = new RestRequest(Method.POST);
    request.AddHeader("Authorization", "KEYREMOVED");
    request.AddParameter("Data", JsonSerializer.Serialize(data));
    request.AddParameter("Locale", "en-US");
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);

NOTE: I have also tried the data param like this:
request.AddParameter("Data", JsonSerializer.Serialize(data).ToString());

Hello @sphilson,

Please check out the example

It seems that you're missing some parameters.

Best Regards,
Petr Bushuev
Plumsail team

Is the .File param required? That doesn't make sense, since I am calling a Process, and hte process has a file defined already.

Hello @sphilson,

For starting the process you can use this code:

var client = new RestClient("https://api.plumsail.com/api/v1/processes/qza36j6e/vsg9xr9/start");
var request = new RestRequest(Method.POST);
request.AddJsonBody(File.ReadAllText("json1.json"));
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

where json1.json - a file that contains process JSON data parameters

{
  "prop1": "value1",
  "prop2": "value2"
}

Best Regards,
Petr Bushuev
Plumsail Team

AWESOME!!! This worked!!!!! Thank you @Petr

2 Likes