This is likely a dumb question but I looked through your (working) code and I don’t see where the URL is called out. Like api.hubspot.com/crm/v3/objects/tickets.
For some reason I have no problem at all getting these API calls to work in Postman. It would be so much more helpful/easier if I could just copy the JSON code over from Postman to Hubspot but there are almost always errors.
This took all of 5 minutes to get working:
But when I try all four of these JS Postman “conversions” none work. (I am copying in my API code)
NodeJS - Axios
const axios = require(‘axios’);
let data = JSON.stringify({
“properties”: {
"otis\_ticket": "12345"
}
});
let config = {
method: ‘patch’,
maxBodyLength: Infinity,
url: ‘https://api.hubapi.com/crm/v3/objects/tickets/26941972792’,
headers: {
'Content-Type': 'application/json',
'Authorization': '••••••',
'Cookie': '\_\_cf\_bm=yZkctTLsozMjwzvhVHKJzQ8xuEdN0fBrIkewSin4mpc-1753715052-1.0.1.1-dpEsJkgVM\_EHcb5QfaTjLl3KyNIsezUFg4JtoDvR2jwB7bW9UN5bVLgTxRnHGA\_L7AGgKRarHNiE6nUsoOQuUMTbaTk0wqqat1FHrIjq2rk'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
NodeJS - Native
var https = require(‘follow-redirects’).https;
var fs = require(‘fs’);
var options = {
‘method’: ‘PATCH’,
‘hostname’: ‘api.hubapi.com’,
‘path’: ‘/crm/v3/objects/tickets/26941972792’,
‘headers’: {
'Content-Type': 'application/json',
'Authorization': '••••••',
'Cookie': '\_\_cf\_bm=yZkctTLsozMjwzvhVHKJzQ8xuEdN0fBrIkewSin4mpc-1753715052-1.0.1.1-dpEsJkgVM\_EHcb5QfaTjLl3KyNIsezUFg4JtoDvR2jwB7bW9UN5bVLgTxRnHGA\_L7AGgKRarHNiE6nUsoOQuUMTbaTk0wqqat1FHrIjq2rk'
},
‘maxRedirects’: 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on(“data”, function (chunk) {
chunks.push(chunk);
});
res.on(“end”, function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on(“error”, function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
“properties”: {
"otis\_ticket": "12345"
}
});
req.write(postData);
req.end();
NodeJS - Request
var request = require(‘request’);
var options = {
‘method’: ‘PATCH’,
‘url’: ‘https://api.hubapi.com/crm/v3/objects/tickets/26941972792’,
‘headers’: {
'Content-Type': 'application/json',
'Authorization': '••••••',
'Cookie': '\_\_cf\_bm=yZkctTLsozMjwzvhVHKJzQ8xuEdN0fBrIkewSin4mpc-1753715052-1.0.1.1-dpEsJkgVM\_EHcb5QfaTjLl3KyNIsezUFg4JtoDvR2jwB7bW9UN5bVLgTxRnHGA\_L7AGgKRarHNiE6nUsoOQuUMTbaTk0wqqat1FHrIjq2rk'
},
body: JSON.stringify({
"properties": {
"otis\_ticket": "12345"
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
NodeJS - Unirest
var unirest = require(‘unirest’);
var req = unirest(‘PATCH’, ‘https://api.hubapi.com/crm/v3/objects/tickets/26941972792’)
.headers({
'Content-Type': 'application/json',
'Authorization': '••••••',
'Cookie': '\_\_cf\_bm=yZkctTLsozMjwzvhVHKJzQ8xuEdN0fBrIkewSin4mpc-1753715052-1.0.1.1-dpEsJkgVM\_EHcb5QfaTjLl3KyNIsezUFg4JtoDvR2jwB7bW9UN5bVLgTxRnHGA\_L7AGgKRarHNiE6nUsoOQuUMTbaTk0wqqat1FHrIjq2rk'
})
.send(JSON.stringify({
"properties": {
"otis\_ticket": "12345"
}
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw\_body);
});