Update tags for all posts inside a community by admin

Hi,

I need to update a tag for posts in community. Is there any easy way for admin to do that in bulk?
So far what I figured out is that I can get all the posts by tags Amity API and then update one by one through Amity API
But it is a heavy operation. Let say I have 1000s of posts against tag and I have to update them all one by one.

Can you tell me if there is any bulk operation support where I can update all the tags at once.

Regards,
Nasir

@muhammad.nasir.ext Unfortunately, we don’t currently have a bulk operation feature for updating tags in posts. You may need to use the Amity API to fetch posts by tags and update them individually. If you have a large number of posts, consider scripting a solution on your end. We apologize for any inconvenience and appreciate your understanding.

@amitysupport how this tags filters in Get Posts call Amity API?

I have tag=[“tag1”] in one post1 and tag=[“tag2”] in post2. I tried to fetch both the posts with tags like tags=tag1&tags=tag2 in query. I am assuming that it should return both the posts but it always return the post1.

There is one issue that I can’t get posts by passing only single tags. API always expect to have multiple tags in the query string. If a pass like &tags=tag1 then it throws following error.

{
    "status": "error",
    "message": "Parameters validation error!",
    "code": 500000,
    "data": {
        "detail": [
            "The 'tags' field must be an array."
        ]
    }
}

A work around is to pass and additional empty tags &tags=tag1&tags=

Also there is one more issue in swagger that it isn’t accept numbers like 333 or 33 for tags value

Last thing that I have value 33 in tags and if query for tags=33 than it isn’t working. It is working for other tag numbers like 35, 39 etc but not working for 33. Please check this as well

Regarding your query, please format it as follows: tags[]=tag1&tags[]=tag2.

We have tested tag 33 and there isn’t an issue. Swagger tool can sometimes cause issues. Therefore, we recommend testing the API using Postman, which often yields more efficient results.

Thank you for checking. It appears to be functioning correctly with the tags[] parameter. My assumption is that when multiple tags are included in the query, they are treated as logical OR conditions rather than logical AND conditions.

1 Like