Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Compare the two for a few seconds... (1... 2... 3...) The content of an object (map) is on a separate level in the YAML with its own indent level and list items are denoted by hyphens ("-"). No brackets, commas and quotes needed. That's about what you need to know about YAML to read the examples. (On json2yaml.com you can easily convert between the two formats.)

Response

Settings

TODO: One setting: The checkbox search_retrieve_enabled needs to be checked in the Setup tool.

TODO - Details

...

Query syntax

See the examples above and Search Parameters for a list of all valid parameters and a detailed description on each one of them.

IDs and ID based lookup

If the ID of a content item is already known from a previous search request it can easily be retrieved using the ids parameter as in the example above.

There are different kinds of IDs used in XperienCentral for different purposes. Content Item IDs are used to request specific content items via this API, often in combination with a specific language. That will return the current (=active) version in that language. Version IDs are never used in the API. Content Item can be either a Page or a Media Item. Since the numerical ID used for pages and media items might overlap this internal ID is prefixed by either "P" for Page or "M" for Media Item in this API.

Languages and "Display-on" pages

The results can be limited to one or a number of explicit languages using the languages parameter. See the Search Parameters below for details on the format.

A Media Item is rendered via its "display-on" page. The language of the Media Item decides the language version of the display-on page. Therefore ensure that display-on pages are available in all different languages.

Response

Successful responses

A successful response has a results field containing a list of results. See examples above. A successful result always starts with the following field:

Code Block
    "_searchRetrieve" : {
      "contentItemID" : "M123",
      "language" : "nl_NL",
      "success" : true
    }

As you can see it contains the Content Item IDlanguage and a field saying it is okay. The JSON that comes thereafter is decided by the JSON presentation of the Content Item.

Response item errors

Notice: Possible subject to change in the next version

If there is an error for a specific item, the result for that item will look like this:

Code Block
    "_searchRetrieve" : {
      "error" : "A message describing the error",
      "success" : false
    }

This rarely happens, since these items are usually not even returned by the search. Therefore this situation may be fully removed so that items with errors will never be returned at all.

Failed search request

A search might fail, for example because of a malformed search query. In that case the response will contain an error message. Since an internal parse error is passed on it might look complicated like this:

Code Block
{
  "error" : "Error parsing search query: Unrecognized field \"idsxxx\" (class nl.gx.product.wmaheadlesssearchretrieveapi.api.data.SearchDefinition), not marked as ignorable (9 known properties: \"keywordCategories\", \"keywordsNot\", \"from\", \"text\", \"keywordsOr\", \"keywordsAnd\", \"ids\", \"languages\", \"to\"])\n at [Source: java.io.StringReader@4e4183f0; line: 3, column: 4] (through reference chain: nl.gx.product.wmaheadlesssearchretrieveapi.api.data.SearchAndRetrieveQuery[\"search\"]->nl.gx.product.wmaheadlesssearchretrieveapi.api.data.SearchDefinition[\"idsxxx\"])"
}

Still it you look carefully it can tell you that a field name idsxxx was used in place of one of the valid ones listed, including ids.

Settings

There is only one setting for the API in the Setup Tool ("/web/setup"), but it is an important one, since its checkbox must be checked to enable access to the API. The setting is called:

search_retrieve_enabled

Anchor
search-parameters
search-parameters
Search parameters

The list below are the currently supported parameters for querying the Search & Retrieve API. This list will be expanded in future releases.

...