# HubDB and contentsearch: does it work?

**URL:** <https://community.hubspot.com/t/hubdb-and-contentsearch-does-it-work/60554>\
**Category:** APIs & Integrations\
**Tags:** cms-content\
**Created:** [July 7, 2022, 6:41pm UTC](https://community.hubspot.com/t/hubdb-and-contentsearch-does-it-work/60554 "2022-07-07T18:41:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![morungos1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@morungos1](https://community.hubspot.com/u/morungos1)\
**Post date:** [July 7, 2022, 6:41pm UTC](https://community.hubspot.com/t/hubdb-and-contentsearch-does-it-work/60554/1 "2022-07-07T18:41:17Z")

</div>

I’m trying to get some kind of content search working with HubDB tables, and even though I know the content is there, I’m always getting back an empty results set.

The URL is more or less:

[https://api.hubapi.com/contentsearch/v2/search?portalId=\<nnn\>&term=sales&tableId=\<nnn\>](https://community.hubspot.com/)

If I drop the

tableId

, I get back records for other content, but I need to be able to peek inside the HubDB tables specifically.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [July 11, 2022, 10:03pm UTC](https://community.hubspot.com/t/hubdb-and-contentsearch-does-it-work/60554/2 "2022-07-11T22:03:40Z")

</div>

Hi, @morungos1 👋 Thanks your question — @piersg do you have any thoughts here?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [July 18, 2022, 9:10am UTC](https://community.hubspot.com/t/hubdb-and-contentsearch-does-it-work/60554/3 "2022-07-18T09:10:02Z")

</div>

Hi @morungos1, the content search API wouldn’t work for this. I just use fetch/AJAX and the HubDB API to do this, e.g.

```lia-code-sample
const searchResult = (url, searchItem) => {
	fetch(url)
		.then(response => response.json()
		.then(data => {
	 		const results = data.objects;
	 		results.forEach(obj => { // gives you each row of the table
				// search for something e.g.
				if (obj.name.toLowerCase().includes(searchItem.toLowerCase())) {
					console.log(obj);
				}
	 		});
		})
	)
};

const url = "https://api.hubapi.com/hubdb/api/v2/tables/[TABLE ID]/rows?portalId=[PORTAL ID]";

searchResult(url, "sales");

```
