I do so, using $ http with PUTS.
.service('LoginService', ['$http',
function($http) {
this.getToken = function(login, senha) {
return $http({
method: 'PUT',
url: "https://url.do.site.com/usuarios/token/acesso",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "*/*",
"Usuario-Login": login,
"Usuario-Senha": senha
}
}).then(function(data){
return data;
}).catch(function(error){
console.log(error);
})
}
}
])
or so using POST
$http({
method: 'POST',
url: 'https://url.do.site.com/usuarios/novo/usuario',
params: {
email: usuario.email,
nome_usuario: usuario.nome_usuario,
patrocinador: usuario.associado,
nome: usuario.nome,
cpf: usuario.cpf
},
headers: {
"Content-Type": "application/vnd.api+json",
"accept": "*/*"
}
}).then(function(data){
console.log(data);
}).catch(function(error){
console.log(error);
})
It will depend a lot on how the API wants to receive the data.