Comunidade

Ask a Question
Back to All

Erro 415 ao tentar obter o código de checkout

Tentando obter o código de checkout usando

"https://ws.pagseguro.uol.com.br/v2/checkout?email=" & email & "&token=" & token

recebo o seguinte erro 415: The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Cannot consume content type).

Na documentação diz:
HTTP 415 – Cannot consume content type###
Ocorre quando não é encaminhado o Content-Type na chamada.
Mas no request vai o content-type application/json. O código que estou usando para fazer esta chamada peguei lá mesmo na documentação: (C# Restsharp)
var client = new RestClient("https://sandbox.pagseguro.uol.com.br/v2/checkout/payment.html?code={código de checkout}");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
IRestResponse response = client.Execute(request);