UnsupportedRequestContentType


(Rize Up Connect) #1

I am creating a request for a new customer account using a sandbox account. I keep getting the message:

{“code”:“UnsupportedRequestContentType”,“message”:“Invalid request Content-Type. Expected ‘application/json’ or ‘application/vnd.dwolla.v1.hal+json’.”}

And this is the request details:

            var client = new RestClient("https://api-uat.dwolla.com");

            var request = new RestRequest("/customers", Method.POST);

            request.AddHeader("Content-Type", "application/vnd.dwolla.v1.hal+json");
            request.AddHeader("Accept", "application/vnd.dwolla.v1.hal+json");
            request.AddHeader("Authorization", string.Format("Bearer {0}", "***secret***"));

            request.RequestFormat = DataFormat.Json;

            request.AddObject(new
            {
                firstName = "Name",
                lastName = "Last Name",
                email = "email@email.com"
            });

(Spencer Hunter) #2

@RizeUp_Connect, Are you using RestSharp? Checkout the thread below as it may be related to the issue you’re running into.