APIs & Integrations

TDwebdev
Contributor | Diamond Partner
Contributor | Diamond Partner

How to check if two values from a array exist in hubdb

Hi,

 

I want to check if the values email and product_name from each array:

Array
(
    [0] => Array
        (
            [lastname] => test
            [name] => Company
            [email] => test@test.nl
            [rating] => 6
            [message] => test
            [product_name] => Product 3
            [date] => 11-04-2022
        )

    [1] => Array
        (
            [lastname] => Test
            [name] => Company
            [email] => test@test.nl
            [rating] => 4
            [message] => Test review 2
            [product_name] => Product 3
            [date] => 11-04-2022
            [firstname] => Peter
        )

    [2] => Array
        (
            [lastname] => test
            [name] => Company
            [email] => test@test.nl
            [rating] => 7
            [message] => test review
            [product_name] => Product 2
            [date] => 11-04-2022
            [firstname] => Twan
        )

)

 Exist in hubdb en if the values exist do nothing and if not exist insert via the hudb api.

 

I get the reviews from the hubdb via api that works, but now i have to check the values van hubdb are equel to the values of the array above

 

De question is there a way to check if the email and product exist in the hubdb. I need a sort query api (for example as SQL)

 

 



Vet Digital

Did my post solve your question? Help the community by marking it as a solution
0 Upvotes
1 Reply 1
ChehakWadhdwa
Member | Diamond Partner
Member | Diamond Partner

How to check if two values from a array exist in hubdb

hi @TDwebdev 

use the api get rows for a table from here = https://developers.hubspot.com/docs/api/cms/hubdb

jus in the api url add in last = /cms/v3/hubdb/tables/{tableIdOrName}/rows?name=<value>&email=<email>

 

then from result check if the total in the json if it is greater then 0 then record found else no and in else case you can use the insert api  to insert the data 

 

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

 

0 Upvotes