Blog Post list filtered by Name containing some text

SOLVE
Highlighted
Occasional Contributor

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

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Community Manager

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?

Reply
0 Upvotes
3 Replies 3
Community Manager

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?

Reply
0 Upvotes
Community Manager

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. 

Reply
0 Upvotes
Occasional Contributor

Hi,

 

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

It is doing what i was looking for Smiley Happy.

 

Thank you for your help