JvrBaena / node-mkm-api

Node.js wrapper for MagicCardMarket API
8 stars 5 forks source link

How can i construct a PUT command with an xml body? #2

Closed Quinten closed 6 years ago

Quinten commented 6 years ago

I am trying to change articles in a user's stock. Which is described here: https://www.mkmapi.eu/ws/documentation/API_2.0:Stock

But i can't seem to get it to work.

I call the api like this:

mkm.request('PUT', '/ws/v2.0/stock', {article: articles}).then(res => {
    console.log(res);
    console.log(res.response);
 }).catch(e => {
    console.log(e);
});

where articles is an array i build with

articles.push({
    idArticle: article.id,
    price: article.price
});

But MKM returns status code 401, which means 'not authorised'

If i use a GET request and another path, it works.

Do you have some tips on how to make this work?

Quinten commented 6 years ago

I think i posted this in the wrong repo. Sorry!