Read and update configurations
Important
To read and update configurations you need the GraphQL Configuration Access module installed and activated.
To use the queries and mutations of this module, admin rights are needed.
This means that the user has to be assigned to the oxidadmin
-group.
List configurations
To read or update configurations it’s important to know which type the configuration has, you want to modify
or read to.
Three list queries are available to figure that out. One for module- (moduleSettings
), one for theme- (themeSettings
)
and one for shop-configurations (shopSettings
).
Here is one example how to use it:
query settings {
moduleSettings(
moduleId: "awesomeModule"
) {
name
type
supported
}
}
{
"data": {
"moduleSettings": [
{
"name": "intSetting",
"type": "num",
"supported": true
},
{
"name": "floatSetting",
"type": "num",
"supported": true
},
{
"name": "boolSetting",
"type": "bool",
"supported": true
},
{
"name": "stringSetting",
"type": "str",
"supported": true
},
{
"name": "arraySetting",
"type": "arr",
"supported": true
}
]
}
}
The returned data is showing the name
of the setting, the type
, to know how to fetch or change the
setting and whether the type is supported
by the module queries and mutations at all.
Read configurations
If the type is known, you can read the setting by using one of the type separated queries.
The name
of the setting and in our case the corresponding module
is necessary to explicitly
select the configuration.
query booleanSetting {
moduleSettingBoolean(
name: "booleanSetting",
moduleId: "awesomeModule"
) {
name
value
}
}
{
"data": {
"moduleSettingBoolean": {
"name": "booleanSetting",
"value": false,
}
}
}
Update configurations
To update a setting, the name
, the new value
and in our case the module
is necessary.
mutation changeBooleanSetting {
moduleSettingBooleanChange(
name: "booleanSetting",
value: true
moduleId: "awesomeModule"
) {
name
value
}
}
{
"data": {
"moduleSettingsBooleanChange": {
"name": "booleanSetting",
"value": true,
}
}
}
Important
Pay attention that the types for module/theme/shop-queries or mutations can be different. Also the handling of the values depends on the implementation in the shop. Only the handling of Theme-configurations are currently implemented by the module itself.
List Themes
Use this query to get the list of all themes. You can use filter like title
to filter themes by there titles or
active
to filter themes on basis of the status.
query themeListFilter {
themesList (
filters: {
title: {
contains: "Theme"
}
active: {
equals: true
}
}
) {
id
title
version
description
active
}
}
{
"data": {
"themesList": [
{
"id": "apex",
"title": "APEX Theme",
"version": "1.3.0",
"description": "APEX - Bootstrap 5 TWIG Theme",
"active": true
},
{
"id": "wave",
"title": "Wave Theme",
"version": "3.0.1",
"description": "Wave is OXID`s official responsive theme based on the CSS framework Bootstrap 4.",
"active": true
}
]
}
}
Switch Theme
In order to activate a theme by a given ID pass themeId as identifier
. If errors during the activation process
occur, they will be raised and shown.
mutation switchTheme{
switchTheme(themeId: "apex")
}
List Modules
Use this query to get the list of all modules. You can use filter like title
to filter themes by there titles or
active
to filter modules on basis of the status.
query modulesList {
modules(
filters: {
title: {
contains: "GraphQL"
}
active: {
equals: true
}
}
) {
id
version
title
description
thumbnail
author
url
email
active
}
}
{
"data": {
"modules": [
{
"id": "oe_graphql_base",
"version": "9.0.0",
"title": "GraphQL Base",
"description": "<span>OXID GraphQL API Framework</span>",
"thumbnail": "logo.png",
"author": "OXID eSales",
"url": "www.oxid-esales.com",
"email": "[email protected]",
"active": true
},
{
"id": "oe_graphql_storefront",
"version": "3.0.0",
"title": "GraphQL Storefront",
"description": "OXID GraphQL Storefront",
"thumbnail": "logo.png",
"author": "OXID eSales",
"url": "https://github.com/OXID-eSales/graphql-storefront-module",
"email": "[email protected]",
"active": true
}
]
}
}
Activate/Deactivate Module
In order to de/activate a module by a given module id as moduleId
, you will receive response as Bool value if the
module was de/activated. Otherwise you will receive an error message.
mutation activateModule{
activateModule(moduleId: "awesomeModule")
}
{
"data": {
"activateModule": true
}
}
Important
Some modules can’t be deactivated as they are listed in the module_blocklist.yaml
.`
This yaml-file contains a list of modules which are necessary to handle configurations or de/activate modules via
GraphQL. Modules like oe_graphql_base
and oe_graphql_configuration_access
are listed there.