3 Ways to Retrieve Properties for a Record Using the HubSpot APIs

Dennis Edson shows three ways to pull properties from HubSpot records: query parameters, the search endpoint, and GraphQL. Pick the method that fits your workflow.
Hello everybody. Dennis Edson here, developer advocate at HubSpot and let's do a new developer byte. It's been a hot minute so I wanted to do something for you all. I've been seeing in the community quite a bit that people often struggle with getting the non default properties to be returned in their CRM API requests. So I thought I would do a short video on returning it three different ways. So let's get at it. All right, let's just go ahead and take a look at this contact record here. We got eggs and in this contact that we have a custom property called ingredients and we want to return that real quickly. Let's just demonstrate what would happen if we did not really actually ask for ingredients. The contact record is 5,01. So let's go on over here to Postman and if you're not use Postman. I'll make sure to link to this in the description below.hubapi.com CRM let's see,/v3 I think it is yes,/v3/objects,/contacts. And we are looking for 501 end of contact. And we still. Let's make sure we have our authorization. We have a bear and it's a token. Okay, cool. All that's good and hit send. And we should get our contact record. And ingredients is definitely not in here. So let's fix that. The quickest way or the easiest way from here if you only have like one or two, is to hit add a query parameter at the end of this, which is called properties equals and the name of the property that you want to return. Hit send. And now you'll see that we have ingredients. You'll also notice that there are a few missing properties here. So if you wanted to add more like let's say just email for example, type an email at the end there and that should also now return email. You continue blah blah blah with more properties if you need them. But you're probably saying wait, whoa, whoa, whoa, whoa. It's going to look cumbersome if I have like, you know, 50 properties in here. If that is the case, then I think it's time we turn to our search endpoint. So I want to do a post request instead. I'm going to change this to right here, get rid of that search there. And now we're going to type something in our body. So move over raw and this is going to be JSON. All right, now let's write this out. This is going to be filter groups, colon and array and object and filters Colon. All right, and now we want to use the HS object id. So that is going to be properties. So we're searching by property. I'm sorry, property name is agent object ID and the operator is going to be EQ for equal and the value, if you've been following along at home, you guess it is 5, 0, 1. Now if we just do that, let's see what happens. Let's see if I typed in correctly at all. Cool. We got one result. There's only one thing that's what we want. Be weird if it didn't. And you'll notice in here that, yes, those standard things are again returned. So let's add some properties to be returned here. That goes here and that is going to be in that I want to. All right, now if I just do a send on that. What a bing. What a bam. Ingredients is there. And if you want to do, you know, multiple things like email, add that, send it, and there we go. And I said, I give you three different ways to go about this. So let's try one more method and that is going to be using our GraphQL. This is relatively new, but if you've not heard anything about GraphQL, I'll again leave a link to that in the description. All right, and this is going to be a different endpoint. We're going to go to collector/graphql. All right, now we are still going to authenticate the same way, but we're going to use GraphQL syntax this time. So we do a query and my query now inside here we're going to be searching on the CRM contact and within that unique. I love this autocomplete because I'm an awful typer object. So this is a property that we are going to be searching for. And the unique identifier, if you didn't guess, it is 501. Cool. Now, within that we need to return. What do we want to return? We are going to return ingredients. All right, and let's just see if that works. Let's see if I messed up and how I write that. Awesome. All right, so yes, that's telling us how you have certain amount of points you can use against GraphQL. And if you go down to the bottom, there it is. And if we wanted to say email again and what the heck, let's do first name. All right, and that should also bring it down here again. All right, Ingredients, email and first name. So there are three different ways that you can get your custom properties or any property that's not returned by default by our API three different ways. One is the search, one is through just adding a query parameter to the CRM object API, and the last one is through graphic y'. All. If you like this, go ahead and do that. You know, like subscribe all that good stuff down the bottom. And if you have any questions, go ahead and drop them into the comments below. Bye now.










