HTML JSon POST C #

0

I have the following class:

public class Ticket
{
    public string name { get; set; }

    public string content { get; set; }

    public int itilcategories_id { get; set; }

}

And the following task:

static async Task<Uri> CreateTicketAsync()
{
client.DefaultRequestHeaders.Clear();

List<Ticket> tickets = new List<Ticket>();
tickets.Add(ticket);

var parametro = new
{
     input = tickets.ToArray()
 };

 var jsonContent = JsonConvert.SerializeObject(parametro);
 var contentString = new StringContent(jsonContent, Encoding.UTF8, "application/json");

 contentString.Headers.ContentType = new MediaTypeHeaderValue("application/json");
 contentString.Headers.Add("Session-Token", session_token);

 HttpResponseMessage response = await client.PostAsync("apirest.php/Ticket/", contentString);

            return response.Headers.Location;
 }

In the content of the ticket, HTML is passed, but it is converted to JSON so that it can be sent by the Post, so that it does not appear correctly on the website to which it is sent. Does anyone know how to fix the problem?

Thenthatappearaboveshouldnotappearandamongthosecategoriesshouldexistparagraph.

HTML:beforebeingconverted

<!DOCTYPEhtml><htmlxmlns=\"\"http://www.w3.org/1999/xhtml\"\">\r\n<head>  \r\n<meta http-equiv=\"\"Content-Type\"\" content=\"\"text/html; charset=utf-8\"\"><style type=\"\"text/css\"\"> body,p,td {{font-size:9.0pt;line-height:115%; color:#595959 ;line-height:115%;font-family:'Arial','sans-serif';}}</style> \r\n</head><body><p>Foi recebida a seguinte informacao relativa a umasubscricao JASMIN:</p><br>\r\n<b>Utilizador CIS: </b>{1}</p><b>Nome: </b>{0}</p><b>Morada: </b>{2}</p><b>Codigo Postal: </b>{3}</p><b>NIF: </b>{4}</p><b>Email: </b>{5}</p><b>Parceiro: </b>{6}</p><br>\r\n<br><b>Subscricao Ant: </b>{7}</p><b>Contrato CIS Ant: </b>{8}</p><br>\r\n<br><b>Solucao: </b>{9}</p><b>Subscricao: </b>{10}</p><b>Contrato CIS: </b>{11}</p><b>Inicio: </b>{12}</p><b>Fim: </b>{13}</p><b>Pagamento: </b>{14} {15}</p><b>Ref MB: </b>{16}</p><br>\r\n</body></html>",

Any questions please let us know!

    
asked by anonymous 28.03.2018 / 12:11

0 answers