GET /api/v1/[project]/plugins/favorite/[type]
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.
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
GET /api/v1/[project]/plugins/favorite/[type]
Returns
{
"favorites": [
"my_widget3",
"my_widget2"
]
}
POST /api/v1/[project]/plugins/favorite/[type]/[value]
DELETE /api/v1/[project]/plugins/favorite/[type]/[value]
If duplicates are allowed, all occurrences of the value will be removed.
POST /api/v1/[project]/plugins/favorite/[type]
{
"favorites": [
"my_widget3",
"my_widget2"
]
}
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>
...
<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.
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 |
false |
addToList |
|
POSTed values will be added at
the end ( |
|
Disclaimer: This plugin does not support parallel requests on the same favorite type!
The plugin supports different types of nodes.
Interested?