# Querying data via the REST API

**URL:** <https://community.hubspot.com/t/querying-data-via-the-rest-api/29926>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [January 8, 2021, 7:38pm UTC](https://community.hubspot.com/t/querying-data-via-the-rest-api/29926 "2021-01-08T19:38:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidThielen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/davidthielen/32/16221_2.png) [@DavidThielen](https://community.hubspot.com/u/DavidThielen)\
**Post date:** [January 8, 2021, 7:38pm UTC](https://community.hubspot.com/t/querying-data-via-the-rest-api/29926/1 "2021-01-08T19:38:03Z")

</div>

Hi all;

This is a basic getting started question. And the answer must exist somewhere, but I can’t find it. So apologies asking if it’s answered somewhere.

So using Deals as an example, is there a way to:

1. Get all properties, including their type.
2. If a property is a foreign key to the primary key in another object (or whatever this is called here), that it identifies itself as a link and to what object?
3. Is it possible to do a GET for a collection deals where it gives a filter against any set of properties (like “Contact’s Industry contains “Acme””?
4. Is it possible to do a GET with filters where it returns a count of objects that would be returned, but in this case just returns the number?

thanks - dave

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [January 11, 2021, 8:38pm UTC](https://community.hubspot.com/t/querying-data-via-the-rest-api/29926/2 "2021-01-11T20:38:19Z")

</div>

Hey @DavidThielen

Let’s walk through these.

First of all, the call is basically the same for any Object. You will just replace the objectType with whatever object you are wanting.

Secondly, I would recommend reading through [this](https://developers.hubspot.com/docs/api/crm/understanding-the-crm?_ga=2.144787836.938277155.1610379986-1273358196.1598626193) to just get a good overview of the crm

1. `https://api.hubapi.com/crm/v3/properties/objectType` will list all properties. You can see all of the endpoints [here](https://developers.hubspot.com/docs/api/crm/properties?_ga=2.144787836.938277155.1610379986-1273358196.1598626193)
2. I believe you are talking about associations. You can use this endpoint `/crm/v3/objects/deals/{dealId}/associations/{toObjectType}`
3. You can use the search endpoint here : `/crm/v3/objects/deals/search` . Do note that this is a **post** request as you will be adding your search in a json body which ends up looking like this`{ "filterGroups": [{ "filters": [ { "value": "string", "propertyName": "string", "operator": "EQ" }] } ], "sorts": ["string"], "query": "string", "properties": ["string"], "limit": 0, "after": 0 }​`
4. The above request will return a total.

Hope this answers some questions!
