XF 2.2 API Get requests working but not Post

bookworm3000

New member
Hello I am trying to update my profile via the API while using Node.js with Axios.

Here is my code, the header seems to be working just find and Axios objects seems to be creating properly.
const axios = require('axios');
const qs = require('qs');

const website = axios.create({
baseURL: 'http://website.com/api/',
headers: {
'XF-Api-Key': 'apikey',
'Content-Type': 'application/x-www-form-urlencoded',
'XF-Api-User': '1',
}
});

My get requests are working properly and returning the expected values
website.get('/users/find-name',
{ 'params': {'username': 'admin'} }
)
.then(response => {
//console.log(response.data);
})

However, when I attempt to do a post request I do not receive any errors but rather it just returns as if i had sent a get request.
website.post('/me/',
{ 'params': {'visible': false}}
)
.then(response => {
console.log(response.data);
})

Instead of returning the proper Response of, success true/false I am just getting the whole user json as if I had sent a get request. If you have any ideas of what I could be doing wrong please post below, thank you!
 
Top