APIs & Integrations

romaindalichamp
Membre

Blog Post list filtered by Name containing some text

Résolue

Hi HubSpot,

 

Using the HubSpot API, i would like to get a list of BlogPost, filtered by name with kind of "contains", not only the exact Title:

If y have many BlogPosts with similars titles like: My New Draft on Hubspot

I would like to be able to get all the BlogPost with a title which contains: "Draft"

I have checked the documentation: https://developers.hubspot.com/docs/methods/blogv2/get_blog_posts

It says: name=>Returns the posts that match the name value. Supports exact, contains, icontains, ne lookups.

 

Nb. I am not using hapikey but oAuth authentification

So i have tried the following, but it works only if i give the exact title

https://api.hubapi.com/content/api/v2/blog-posts?name=Draft

 I have also tried:

https://api.hubapi.com/content/api/v2/blog-posts?contains=Draft

or:

So i have also tried:

https://api.hubapi.com/content/api/v2/blog-posts?name_contains=Draft

But nothing returns me a result as i would expect.

Can you explain me how to use the "Contains" ?

Thank you for your help

Romain

0 Votes
1 Solution acceptée
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Blog Post list filtered by Name containing some text

Résolue

Hey @romaindalichamp,

 

Thanks for the detailed explanation. 

 

When looking to append filter type on the supported parameter, you would need to use a double underscore as stated in this documentation - List blog posts | CMS Blog API

 

For now, it looks like contains will return us with a 400 error and for this I would need to check in with our internal team. That said, in the meantime, icontains should work just fine:

?name__icontains=Draft

 

Could you try and see if it works for you?

Voir la solution dans l'envoi d'origine

0 Votes
3 Réponses
WendyGoh
HubSpot Employee
HubSpot Employee

Blog Post list filtered by Name containing some text

Résolue

Hey @romaindalichamp,

 

Just an update here, I have checked in with our product team and currently we do not support filtering by contains on the name propety. However, if insenstive contains (icontains) isn't sufficient, please do share with me your use case and I'll be happy to pass it along to our product team. 

0 Votes
romaindalichamp
Membre

Blog Post list filtered by Name containing some text

Résolue

Hi,

 

Than you for your answers. THe "icontains" solution is working fine for me

It is doing what i was looking for :).

 

Thank you for your help

WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Blog Post list filtered by Name containing some text

Résolue

Hey @romaindalichamp,

 

Thanks for the detailed explanation. 

 

When looking to append filter type on the supported parameter, you would need to use a double underscore as stated in this documentation - List blog posts | CMS Blog API

 

For now, it looks like contains will return us with a 400 error and for this I would need to check in with our internal team. That said, in the meantime, icontains should work just fine:

?name__icontains=Draft

 

Could you try and see if it works for you?

0 Votes