Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

exp:expgraphqlenable

Switch the GraphQL API on in one command: the siteaccesses, the mutations, CORS for a front end, an API key, the schema, a curl example; a dry run unless --apply.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/examples/commands/expgraphqlenable.md

On this page

exp:expgraphqlenable

Switch the GraphQL API on in one command: the siteaccesses, the mutations, CORS for a front end, an API key, the schema, a curl example; a dry run unless --apply.

Script bin/php/expgraphqlenable.php, code in kernel/private/classes/commands/expgraphqlenable.php. Run it from the installation root, as the user the web server runs as:

./console exp:expgraphqlenable --help
./console exp:graphql:enable --help
php bin/php/expgraphqlenable.php --help

Help text

Switch the GraphQL API on
Sets graphql.ini [GraphQLSettings] Enabled=enabled in settings/override, adds the siteaccesses of
--siteaccess to SiteAccessList[] (without it the API answers in every siteaccess); the mutations
come on with it (MutationsEnabled=enabled, the default), and --mutations writes that too, where
exp:graphql:disable --mutations switched them off. Lets a front end's origin call it with
--origin (rest.ini [CorsSettings]), makes a personal API key for a user with --key-for (the token
is shown once), checks that the schema builds, and prints the end point, a curl example and the
playground. Shows the changes as a diff and writes nothing without --apply; with --apply each file
is backed up first and the INI caches are cleared.

./console exp:graphql:enable                                        what would change
./console exp:graphql:enable --siteaccess=site --apply
./console exp:graphql:enable --siteaccess=site --origin=https://shop.example.com --key-for=frontend --apply
./console exp:graphql:enable --siteaccess=site --mutations --key-for=editor --apply

Exit code: 0 done (or shown); 1 a file could not be written, or the key not made; 3 the library is
missing; 2 wrong options (an unknown siteaccess or user, an origin that is not one).

Options

OptionValueHelp
--siteaccessrequiredthe siteaccesses it answers in, comma separated (default: every siteaccess)
--originrequiredthe origin of a front end allowed to call it from a browser (CORS), comma separated
--mutationsswitch the mutations on again (in the siteaccesses of --siteaccess); they are on by default
--key-forrequiredmake a personal API key for this user (a login)
--key-namerequiredthe name of the key (default: GraphQL front end)
--scoperequiredthe scopes of the key: graphql:read (the default), graphql:write (the default with --mutations)
--daysrequiredthe lifetime of the key in days (rest.ini [ApiKeySettings] ExpiryChoices[]; default 90)
--applywrite; without it nothing is changed

Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).


Generated by ./console exp:help:examples from bin/php/expgraphqlenable.php, kernel/private/classes/commands/expgraphqlenable.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x