Gentics Mesh Favorite Plugin

Gentics Mesh Favorite Plugin

Description

Description

Do you want your users to save their favorite contents?

The favorite plugin allows your users to mark nodes as favorites. If you have multiple kinds of content (e.g. images, videos, blog posts) you can easily configure different categories to separate them visually.

Documentation

Functional Description

  • The plugin stores user-specific lists of strings (favorites) for types (favorite-type)

  • Anonymous calls are not allowed

  • The favorite-types are configured in the config.yml (cross project)

  • The names of the favorite-types can contain letters, numbers, underscores and dashes

  • The following REST calls are supported

    • Get all values for a favorite-type

    • Add single value to favorite-type

    • Remove single value from favorite-type

    • Overwrite all values for favorite-type

REST API

Get favorites

GET /api/v1/[project]/plugins/favorite/[type]

Returns

{
    "favorites": [
        "my_widget3",
        "my_widget2"
    ]
}

Add value to favorites

POST /api/v1/[project]/plugins/favorite/[type]/[value]

Remove value from favorites

DELETE /api/v1/[project]/plugins/favorite/[type]/[value]

If duplicates are allowed, all occurrences of the value will be removed.

Overwrite favorite values

POST /api/v1/[project]/plugins/favorite/[type]
{
    "favorites": [
        "my_widget3",
        "my_widget2"
    ]
}

Installation

Note
Make sure to only use commercial plugins which match the Major and Minor version of the Gentics Mesh server. Plugins which do not match may not be compatible with the Gentics Mesh version.

Commercial plugins can be downloaded from our maven site. Alternatively you can also use maven to download the jar:

mvn dependency:get \
  -Dartifact=com.gentics.mesh.plugin.commercial:mesh-favorite-plugin:$YOUR_MESH_VERSION \
  -DremoteRepositories=gtx-commercial::default::https://maven.gentics.com/maven2-commercial \
  -Ddest=mesh-favorite-plugin.jar -Dtransitive=false

If you get an "Unauthorized" error, please locate your maven settings (usually found in ~/.m2/settings.xml) and add our server to the servers list:

settings.xml
<settings>
 ...
 <servers>
    <server>
      <id>gtx-commercial</id>
      <username> $YOUR_USER_ID </username>
      <password> $YOUR_API_KEY </password>
    </server>
 ...

Once downloaded, place the jar file, optionally together with a config file and other assets, in the configured plugins folder of your Mesh installation — then the plugin(s) will automatically be deployed during server startup.

Configuration

projects:
  - "project_1"
  - "project_2"
types:
    widgets:
        maxEntries: -1
        allowDuplicates: false
        reorderDuplicates: false
        addToList: append
    infobox:
        maxEntries: -1
        allowDuplicates: false
        reorderDuplicates: false
        addToList: append
    ongoing_procedures:
        maxEntries: 3
        allowDuplicates: false
        reorderDuplicates: true
        addToList: append
Key Type Description Default value

projects

array of strings

Project names, for which the plugin is activated

REQUIRED

types

array of objects

Available types with their configuration

REQUIRED

maxEntries

integer

Maximum number of entries stored for the type. -1 for unbounded

-1

allowDuplicates

boolean

Flag to allow duplicate values for the type

false

reorderDuplicates

boolean

Flag to specify behaviour for POSTed duplicates, if allowDuplicates is false. If set to false, duplicates will just be ignored, if true they will be reordered to the back of the list

false

addToList

append or prepend

POSTed values will be added at the end (append) or at the start (prepend) of the list

append

Disclaimer: This plugin does not support parallel requests on the same favorite type!

Plugin Details

The plugin supports different types of nodes.

Interested?

Version

2.0.18

License

commercial

Authors

Gentics