1
22.7 Legacy Series / Re: Using API on api/haproxy/settings/addAcl ==> "result": "failed"
« on: August 22, 2022, 06:33:05 pm »
Hello,
After long road, I was able to make it working in C#.
There is the solution :
Please, notice that I have created classes to manage OpnSense "haproxy", "Client", etc...
After long road, I was able to make it working in C#.
There is the solution :
Code: [Select]
var url = this.haproxy.Client.BaseUrl + this.haproxy.BaseUrl + this.baseUrl + "/addAcl";
var model = new
{
acl = new
{
negate = "0",
name = name,
expression = "hdr_end"
}
};
var response = await this.haproxy.Client.httpClient.PostAsync(url, JsonContent.Create(model));
Please, notice that I have created classes to manage OpnSense "haproxy", "Client", etc...