La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
Im currently attempting to create a HTML form that will send the input data to a HubDB table. I have been attempting to POST this via a serverless function however the data is not making to the database and i am getting a HTTP 415 error for unsupported media type. Can anyone look over my code and tell me where i am going wrong? Ive never done this stuff before and my JavaScript is not great.
const data = JSON.stringify({
values: {
"name": "Name",
"company": "BisName",
"email": "email",
"phone": "fone"
}})
exports.main = (context, sendResponse) => {
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.hubapi.com",
"port": null,
"path": "/cms/v3/hubdb/tables/customer_data/rows?hapikey=MyApiKey",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(data);
req.end();
//sendResponse is what you will send back to services hitting your serverless function.
sendResponse({body: data, statusCode: 200});
};
@JP51 - Hi there. Great question to post and I'm hoping you've either cracked this or @webdew 's answer worked. Could you please let me know? Thank you for posting and helping the community 🙂