You must use the fetch method by entering the API address, identify the method ( POST
, PUT
, GET
, DELETE
), insert the required header and send the data in the request body.
Registration
fetch('https://dev.people.com.ai/mobile/api/v2/register/', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
name: 'Lennon Coelho',
password: 'Senha@12346',
})
}).then((response) => {
return response;
});
Login
fetch('https://dev.people.com.ai/mobile/api/v2/login/', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'Senha@12346',
})
}).then((response) => {
return response;
});
If this is your first time using fetch, in some cases you will need to install and import it, follow the link . .
Additionally you can install some extension like Axios or jQuery AJAX which make calling REST methods easier.