Getting References by Id

Hi Squidex Team,

I have a question how getting content of a references field by id. We have a Java Service which do the calls via REST to the Squidex API.

For example we have a page schema with field slider. The elements of the slider are schema teaser. So if I call this page I getting a JSON like this:

{
“slider”: “1dab58ef-1dab58ef-1dab58ef-1dab58ef”
}

In my code I have to know that the slider elements are of type teaser to get content with url …/teaser/1dab58ef…

Did you know another method to getting this content without to know that the slider elements are of type teaser?

Best regards,
Jens Lehmann

Hi, Jens,

you have three options:

  1. You hardcode it in your code that the id is of type teaser.
  2. You query the schema of the parent type.
  3. You use graphql.

Hi Sebastian,

how can I do the 2nd method?

Best regards,
Jens Lehmann

See the following API: https://cloud.squidex.io/api/docs#operation/Schemas_GetSchema

Hi Sebastian,

thanks, for your reply. Is it also possible that the API have a generic interface to get content by id e.g. …/content/123-123-123-123-123 in one of the next releases?

Best regards,
Jens Lehmann

I have to check the priorities, because it is a bigger task than you might think. The usual flow is to resolve the app, then the schema, then the content and I have to change this for this requirement.

Can you create a feature request for it?

Hi,

I was looking for th same thing, but found no new answer : how to get a node by id without knowing its schema.

Then, I looked into chrome profiler, and I saw an interesting request which is exactly what I was looking for :

GET /content/{app}/?ids={id},{id}

ids are separated by a coma

maybe you added this feature in the meantime, but I cannot see this request in any documentation…
So I hope it can help