Not able to able to get the properties of a deal even while specifying the parameters


#1

I am trying to get the deal name and deal stage for the deals in Hubspot. I am using Node.js to make the API Requests

But the Response I get is something like this-
associations: null,
properties: [Object],
imports: [],
stateChanges: [] },
{ portalId: 2571206,
dealId: 67506375,
isDeleted: false,
associations: null,
properties: [Object],
imports: [],
stateChanges: [] },

As you can see the properties key doesn't display any value. I am able to get the correct response using Postman.

This is the code that I have written to get the request

var fetch = require("node-fetch");
const url='https://api.hubapi.com/deals/v1/deal/paged?hapikey=apikey&properties=dealstage&properties=dealname';

fetch(url)
.then((resp) => resp.json()) // Transform the data into json
.then(function(data) {
    console.log(data);
  // Create and append the li's to the ul
  })

Any help on this matter would be greatly appreciated


#2

Hi @ricky23,

That isn't an issue with the actual data coming from HubSpot; I think that's due to the way Node handles arrays/objects when printing using console.log(). Check out the following Stack Overflow topic for more details: