我正在使用mautic-node npm模块从node.js联系mautic REST API。我的目标是使用mautic REST API从我的应用程序在mautic仪表板中创建联系人,但是在从节点创建联系人时遇到了问题。 js。请帮助我找出答案。
<div reponsive-devices="desktop"></div> #Select this
<ul responsive-os="android"></ul> # Select this
<div class="responsive-"></div> # DON'T select this
我正在将此请求正文传递给后端:-
var mautic = require('mautic-api-node');
var request = require('request');
var config = require('../config/config.js');
var request = require('request');
exports.saveContact = (req, res) => {
queryParameters = JSON.stringify(req.body);
var username = "mauticUsername";
var password = "mauticPassword";
var auth = "Basic " + new Buffer.from(username + ":" +
password).toString("base64");
var options = {
url: 'https://mautic-url/api/contacts/new',
method: "POST",
form: queryParameters,
headers: {
"Authorization": auth
}
};
request(options, (error, response, body) => {
if (error) console.log(error);
console.log("Body", body);
})
}
当我运行此代码时,我会收到此响应
{
"firstname":"firstname",
"ipAddress":"Ipaddress",
"lastname":"lastname",
"email":"email"
}
我想这是GET contact API的响应,所以我很困惑为什么我在执行POST请求以联系API时得到GET API响应,请帮我弄清楚这个问题。