Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Posting data return error with reqres API

$
0
0

I am using reqres API to do a login but it is 400 error which says

{"error": "Missing email or username"}

I tried with postman but same error, this is my URL string from postman

https://reqres.in/api/login?email=eve.holt@reqres.in&password=cityslicka

and I am using the following in JS

form.addEventListener("submit", function(e){    const myData = 'email=eve.holt@reqres.in&password=cityslicka'    e.preventDefault();    fetch("https://reqres.in/api/login", {        method: 'post',        headers : {"Content-Type": "application/x-www-form-urlencoded"} ,        body: {            myData        },    })})

Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>