Hello there,
I’ve been using hotspot to check contacts registered on our plaform using the following code:
const paramData = { // HubSpot API header for HTTP petitions
'params': { "hapikey": hapikey }
};
HTTP.call('GET', `https://api.hubapi.com/contacts/v1/contact/email/${userEmail}/profile`, paramData, function(error, response) {
if (error) {
doSomething();
} else {
doSomethingElse();
and it works, however if try this with the create contact endpoint
const paramData = { // HubSpot API header for HTTP petitions
'params': { "hapikey": hapikey }
};
HTTP.call('POST', 'https://api.hubapi.com/contacts/v1/contact', paramData, function(error, response) {
if (error) {
return console.log(`failed user.createContact API Call: ${error.response.statusCode}, ${error.response.content}`);
} else {
console.log("Succesfully created user")
}
});
i get the following error
{"status":"error","message":"Any of the listed authentication credentials are missing","correlationId":"a7f187e9-5002-40ed-921e-dbb71bedf5a5","engagement":{"oauth-token":"oauth-token not engaged. OAuth access token not found in request header.","hapikey":"hapikey not engaged. hapikey is not present in query params.","shhkey-v1":"shhkey-v1 not engaged. Shhkey not found in the request header.","vendorkey-gae":"vendorkey-gae not engaged. Vendorkey not found in request headers.","app-cookie":"app-cookie not engaged. App cookie is not present on the request.","internal-cookie":"internal-cookie not engaged. Cookie not found in the request."},"requestId":"d3a52cd1277a7a798c6d3ed43b624088"}
so whatever, I’m just testing and i pass the hapikey in the url and pass this as paramData instead:
const data = {
'headers': {'Content-Type': 'application/json'},
'body' : {
'properties': [
{
"property": "email",
"value": "testingapis@hubspot.com"
},
{
"property": "firstname",
"value": "Adrian"
},
{
"property": "lastname",
"value": "Mott"
}
]
}
}
and i get the following error:
{"status":"error","message":"Invalid JSON input: No content to map due to end-of-input at line 1, column 0","correlationId":"68408b6d-dad4-4433-80c8-a8364a0989db","requestId":"cc965d8581a796483141e2adfc9de11d"}
which leads me to belive this endpoint takes the parameters in a different structure than the other one. Any help regarding this will be greatly appreciated.