hello here is my code js to post data hubspot I would like to add onclick event to submit the data
var request = require("request");
var options = { method: 'POST',
url: 'https://api.hubapi.com/contacts/v1/contact/',
qs: { hapikey: 'demo' },
headers:
{
'Content-Type': 'application/json' },
body:
{ properties:
[ { property: 'email', value: 'testingapis@hubspot.com' },
{ property: 'firstname', value: 'test' },
{ property: 'lastname', value: 'testerson' },
{ property: 'website', value: 'http://hubspot.com' },
{ property: 'company', value: 'HubSpot' },
{ property: 'phone', value: '555-122-2323' },
{ property: 'address', value: '25 First Street' },
{ property: 'city', value: 'Cambridge' },
{ property: 'state', value: 'MA' },
{ property: 'zip', value: '02139' } ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});