Hi,
I'm trying to call a web action with a Rest-API call. However I always get the {ok:false} back.
This is my request uri: http://192.168.10.112:3344/printer/api/Prusa_i3_MK3S?a=webCallExecute&data={%22Name%22:%22LightsOff%22%2c%22Params%22:[%22test%22]}&apikey=....
I took the format from the Websocket action:
{action: "webCallExecute", data: {name: "LightsOff", params: ["Test"]}, printer: "Prusa_i3_MK3S",…}
action: "webCallExecute"
callback_id: 1402
data: {name: "LightsOff", params: ["Test"]}
printer: "Prusa_i3_MK3S"
Is there anything I miss? The websocket returns {ok:true} for the action above, only the Rest-API call seems not to work.
This is the C# call of it.
var client = new RestClient(string.Format("{0}{1}:{2}", httpProtocol, ServerAddress, Port));
var request = new RestRequest(!string.IsNullOrEmpty(PrinterName) ? "printer/api/{slug}" : "printer/api");
request.RequestFormat = DataFormat.Json;
request.Method = Method.POST;
request.Timeout = 2500;
if (!string.IsNullOrEmpty(PrinterName))
{
request.AddUrlSegment("slug", PrinterName);
}
request.AddParameter("a", Command, ParameterType.QueryString);
request.AddParameter("data", JsonConvert.SerializeObject(JsonData), ParameterType.QueryString);
request.AddParameter("apikey", API, ParameterType.QueryString);
var fullUri = client.BuildUri(request);
var respone = await client.ExecuteAsync(request);
var result = respone.Content;
Thanks for your help!