Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posting JSON data to a webserver gives error 415 (Unsupported media type 'x-www-form-urlencoded' in request.) #33

Open
redM0nk opened this issue Apr 5, 2017 · 0 comments

Comments

@redM0nk
Copy link

redM0nk commented Apr 5, 2017

I'm using this library to make a POST request to ubidots's server via ESP8266 (ESP-LINK).
One of the requirements is that it only accepts JSON data.
I've tried the following method:

    rest.setHeader("\"Content-Type\":\"application/json\"");
    rest.setContentType("json");
    rest.request(path_data, "POST", "{\"data\":8}");

Output:

ubidots: POST failed with error 415
Response: {"detail": "Unsupported media type 'x-www-form-urlencoded' in request."}

Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant