Plone 6.0.4 Endpoint @querystring-search GET vs POST - GET Method didn't return Metadata Fields

In Plone 6.0.4 a GET Request to REST-API Endpoint @querystring-search is possible. I see two diffrent Results if i change from POST to GET Method. My Question: Why? It's a Bug or a Feature?
The requested metadata_fields are ignored in the GET Request, but in the POST Request all is fine.

Endpoint @querystring-search with POST Method

const url = "http://myplone.local/@querystring-search"
const data = {
    "query": [{
        "i": "portal_type",
        "o": "plone.app.querystring.operation.selection.is",
        "v": ["News Item"]
        }],
    "metadata_fields": ["effective", "CreatorFullname", "targetgroup", "getIcon", "image_scales"],
    "sort_on": "effective",
    "sort_order": "descending",
    "fullobjects": false,
    "limit": 30,
    "b_start": 0,
    "b_size": 30
};

const options = {
    headers: {
        "Content-Type": "application/json", Accept: "application/json",
    },
    credentials: "same-origin",
    method : "POST",
    body : JSON.stringify(data)
};

fetch(url, options)

This is one result item in the response of the POST request:

{
      "@id": "http://myplone.local/Aktuell/News/copy3_of_bild-4-3", 
      "@type": "News Item", 
      "CreatorFullname": "Doe, John", 
      "description": "Vestibulum rutrum, mi nec elementum vehicula, eros quam gravida nisl, id fringilla neque ante vel mi. Donec id justo. Fusce ac felis sit amet ligula pharetra condimentum. Nulla sit amet est. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.", 
      "effective": "2023-04-21T05:29:00+00:00", 
      "getIcon": true, 
      "image_scales": {
        "image": [
          {
            "content-type": "image/jpeg", 
            "download": "@@images/image-4136-04a944fe06aa9f1a42c0899e300b3677.jpeg", 
            "filename": "1-4136x4136.jpg", 
            "height": 4136, 
            "scales": {
              .... some scales ....
              "thumb": {
                "download": "@@images/image-128-773c62682359d8a47d7c288293c279f1.jpeg", 
                "height": 128, 
                "width": 128
              }, 
              "tile": {
                "download": "@@images/image-64-778fd62fc2e4a7fe9c1e17884084310b.jpeg", 
                "height": 64, 
                "width": 64
              }
            }, 
            "size": 1324745, 
            "width": 4136
          }
        ]
      }, 
      "review_state": "external", 
      "targetgroup": "Clinic", 
      "title": "Bild 2:2"
    },

Endpoint @querystring-search with GET Method

const url = "http://myplone.local/@querystring-search"
const data = {
    "query": [{
        "i": "portal_type",
        "o": "plone.app.querystring.operation.selection.is",
        "v": ["News Item"]
        }],
    "metadata_fields": ["effective", "CreatorFullname", "targetgroup", "getIcon", "image_scales"],
    "sort_on": "effective",
    "sort_order": "descending",
    "fullobjects": false,
    "limit": 30,
    "b_start": 0,
    "b_size": 30
};

const options = {
    headers: {
        "Content-Type": "application/json", Accept: "application/json",
    },
    credentials: "same-origin",
    method : "GET",
};

url = url + "?query=" + encodeURIComponent(JSON.stringify(data))

fetch(url, options)

This is one result item in the response of the GET request:

{
  "@id": "http://myplone.local/Aktuell/News/copy_of_bild-4-3", 
  "@type": "News Item", 
  "description": "Vestibulum rutrum, mi nec elementum vehicula, eros quam gravida nisl, id fringilla neque ante vel mi. Donec id justo. Fusce ac felis sit amet ligula pharetra condimentum. Nulla sit amet est. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.", 
  "review_state": "external", 
  "title": "Bild 3:2"
}, 
1 Like

It is probably better to open an issue either on GitHub - plone/plone.restapi: RESTful API for Plone. or GitHub - plone/Products.CMFPlone: The core of the Plone content management system

1 Like