tgrassl
I'm new here

Query Content2Section in CaaS

Hello everyone,

We are currently trying to retrieve Content2Section records via FirstSpirit CaaS. The documentation (CaaS Connect: Module documentation) says that you get a query object to retrieve the records. The problem is that "query" is always null, even in the documentation itself.

How can we query the data then?

Example response:

{
   "displayName" : "blog",
   "entityType" : "blog",
   "filterParams" : {},
   "fsType" : "Content2Section",
   "maxPageCount" : 0,
   "name" : "blog",
   "ordering" : [
  {
   "ascending" : false,
   "attribute" : "fs_id"
  }
  ],
   "query" : null,
   "recordCountPerPage" : 1,
   "schema" : "global",
   "template" : {
   "displayName" : "Blog entry",
   "fsType" : "TableTemplate",
   "identifier" : "e657e0f0-0fd3-456f-b5ab-560a879ca748",
   "name" : "Blog entry",
   "uid" : "global.blog",
   "uidType" : "TEMPLATESTORE_SCHEMA"
  }
}

Thanks

Timon

Labels (1)
6 Replies
hoebbel
Crownpeak employee
Crownpeak employee

Re: Query Content2Section in CaaS

Hello Timon,

have you set a corresponding query on the page reference, or should all records be output?

I would expect NULL at this point if the output of the records is not to be restricted, i.e. no query has been set.

404618_pastedImage_0.png

Many greetings

Holger

0 Kudos
tgrassl
I'm new here

Re: Query Content2Section in CaaS

Hello Holger,

We don't have a specific query set, only [All records]. But I don't understand how to even get all records using this response.

404619_pastedImage_1.png

What we want is the record that corresponds to the current page, e.g. /standorte/münchen.

Thanks

Timon

0 Kudos
hoebbel
Crownpeak employee
Crownpeak employee

Re: Query Content2Section in CaaS

Hello Timon,

I'll have to pass.

Using the json data you can get the table template (uuid e657e0f0-0fd3-456f-b5ab-560a879ca748). This in turn points to the corresponding database table.

Unfortunately I don't know how the relation between datasets and database table is in CaaS. If the dataset knows its table, you can get the datasets through it.

If a query was defined, the reference to the query [template] and all parameters of the query defined on the page template would be output at this point. Again, the records must be fetched from the frontend accordingly.

Sorry - hope someone else can help with this.

Holger

0 Kudos
mareike
Returning Observer

Re: Query Content2Section in CaaS

Hello Holger, thanks for your answer. Is there any example or documentation online on how to push datasets into the caas? We can't find anything according to this topic expect the section Timon posted in the question. In our case each entry of the database represents a single page - but it comes from one Pagereference, that is connected to the database by referencing a content-page with the database as main content. I would assume that the screenshot Timon posted with "all records" is a database query so why is it null? Thank you Mareike

0 Kudos
hoebbel
Crownpeak employee
Crownpeak employee

Re: Query Content2Section in CaaS

Hello Mareike,

Unfortunately, I can only refer to the FirstSpirit functionalities, as I am not familiar with CaaS.

While I'm pretty sure that with CaaS Connect, any change to a record will cause it to be published automatically, I don't want to mislead anyone here because of my lack of information....

on the other hand, the query is a FirstSpirit issue Smiley Happy

Via a query it is possible to limit the number of records that are to be output via the content-projection (pageref).

If no corresponding query is selected, FirstSpirit displays "Alle Datensätze" to show that there is no restriction. This is represented in the JSON output by the fact that NULL is used as the value of the query - as a representation of the fact that no query was selected.

Many greetings

Holger

0 Kudos
Peter_Jodeleit
Crownpeak employee
Crownpeak employee

Re: Query Content2Section in CaaS

Hello,

I'm a bit "late to the train", sorry for this.

As Holger pointed out the attribute "query" is the name of the query in FirstSpirit (see his screenshot). It the value is "null" this means there is no restriction on the datasets.


To get the corresponding datasets from caas you need to know the uid of the table template, which is "global.blog" in your example. Then you can construct an http request like this: <base-url>/<tenant>/<project-id>.preview.content?filter={'template.uid':'Products.products','locale.identifier':'US'} (this example assumes that you want your content for the us locale). You can add additional url query parameters as it fits your needs.


I hope this helps

Peter

Peter
0 Kudos