[IMPLEMENTED] Bulk multiple contents update

Hi, i think could be great if it possible to do bulk update of multiple contents using squidex filter. Currently we have to do request to squidex API on each item. Just a little SQL logick inside squidex / mongodb.

UPDATE table_name
SET column1 = value1
WHERE condition;

It is possible to implement this feature?

Thee is a bulk update feature where you can update multiple items. But you have to do the query first.

But Squidex would have to do the same internally, so I think it does not make sense to implement this.

Currently i do some query with filter. This query return me about 100 of records. It is possible to do using squidex API do update of those 100 records?

Now we are doing this update one by one which is take much time and server resources.

Thanks for you help!

Hi,

it is not part of the API docs, but you have a look at this operation:

      public Task<List<BulkResult>> BulkUpdateAsync(BulkUpdate update, CancellationToken ct = default)
        {
            Guard.NotNull(update, nameof(update));

            return RequestJsonAsync<List<BulkResult>>(HttpMethod.Post, BuildSchemaUrl("bulk", false), update.ToContent(), ct: ct);
        }

It is a endpoint at POST api/content/<app>/<schema>

The payload can be derived from the C# class: https://github.com/Squidex/squidex-samples/blob/master/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/BulkUpdate.cs

So it is something like

{
   "jobs": [{
      "id": "...",
      "type": "changeStatus",
      "status": "Published"
   }]
}

I have enriched the bulk endpoint to support multiple updates.

It can look like this:

{
    "jobs": [{
        "type": "Patch",
        "query": {
            "filter": {
                "path": "data.number.iv",
                "op": "eq",
                "value": 1
            }
        },
        "expectedCount": 123,
        "data": {
            "number": {
                "iv": 5
            }
        }
    }]
}

This topic was automatically closed after 2 days. New replies are no longer allowed.