[OBSOLETE] Get schema contents with set of ids doesn't work

I have…

  • [ ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x ] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Squidex.ClientLibrary (Nuget C#).

  1. Define IContentsClient.

  2. Get items from ids - HashSet type.

    GetAsync(ids)

  3. Observe in proxy tool and see the request url

    <Base_url>/api/content/<project_name>/?ids=<ids>

  4. The request url return 404 not found.
    (It seems missing <shema_name> in the url (like other GetAsync() request).

Expected behavior

It should return list of contents from request ids.

Version: Squidex.ClientLibrary v4.2.0 (Nuget C#).

Hi,

I have a test case for that and I just checked again if it works or not: https://github.com/Squidex/squidex/blob/master/backend/tools/TestSuite/TestSuite.ApiTests/ContentQueryTests.cs#L34

Are you sure that everything else is configured correctly? A 404 can also mean no permissions for apps.

Hi, I’m pretty sure the thing configured properly.
(Validate by do successfully for Create/Get/Update etc at the same schema.)

Permission, I checked it and all fine as I have full access to my app.
(GetAsync() also working fine for me).

I have an ‘alternative’ way to fix my issue.
Here how I do

// ids is the a List<Guid>
// This doesn't work as described above :).
// var result = await <myContentClient>.GetAsync(ids.ToHashSet());

// Temporary using filter OData query instead.
var filter = string.Join(",", ids.Select(id => "'" + id.ToString() + "'"));
var result = await <myContentClient>.GetAsync(new ContentQuery
{
        Filter = $"id in ({filter})"
});

return result.Items;

Which version of Squidex are you using?

Hi,

I have small sample here that fetches contents by ids from the multiple schemas:

using Newtonsoft.Json;
using Squidex.ClientLibrary;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace SquidexRepo
{
    class Program
    {
        public sealed class DynamicData : Dictionary<string, object>
        {

        }

        public sealed class DynamicContent : Content<DynamicData>
        {

        }

        static async Task Main()
        {
            var clientManager = new SquidexClientManager(new SquidexOptions
            {
                AppName = "squidex-website",
                ClientId = "squidex-website:reader",
                ClientSecret = "yy9x4dcxsnp1s34r2z19t88wedbzxn1tfq7uzmoxf60x"
            });

            var client = clientManager.CreateContentsClient<DynamicContent, DynamicData>("blog");

            var blogId = Guid.Parse("4aadb23e-3c8a-464a-aad2-6e93b1f30c1d");
            var featureId = Guid.Parse("46c7c818-fa3f-4a45-b80b-3162ecb04af2");

            var contents = await client.GetAsync(new HashSet<Guid> { blogId, featureId });

            foreach (var content in contents.Items)
            {
                Console.WriteLine($"Id: {content.Id}, Schema: {content.SchemaName}");
                Console.WriteLine(JsonConvert.SerializeObject(content, Formatting.Indented));
                Console.WriteLine();
            }
        }
    }
}

Btw: this feature has been introduced with 3.0, perhaps your installation is too old:

1 Like

Hi @Sebastian,

I contacted to team who set up the installation and yes, it’s too old.
(I don’t have exactly version number right now).
I assume it’s earlier than 3.0, then we can close this ticket.

(Thank you for your support :pray:).