Get the categories attached to a post (and just them)

Hi, I’m trying to fetch all categories attached to a post in a component.
My query is fine when there are some categories attached but when there is not, it returns me all the categories even if they aren’t attached to the post:

  async fetch() {
    this.tags = await this.$storyapi
      .get(`cdn/stories/`, {
        starts_with: 'categories/',
        version: 'draft',
      .then((res) => {
      .catch((err) => console.log(err))

I don’t know what I’m missing here. Thanks a lot for your precious help!

Hello @deodat,

when you use the by_uuids parameter and don’t pass any value to it it will be ignored so that you get the stories from the folder that has been provided with the starts_withparameter.

Best regards

I just realized that a simple condition on the length of the trick.
Anyway, thanks a lot for your help.
Best regards,

1 Like