### Setup S3 Storage Mutation Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example mutation for setting up S3 storage with specific configuration details. ```javascript const mutation = `mutation { storage { updateConfig( key: "s3" config: { bucket: "company-wiki-assets" region: "us-west-2" accessKeyId: "AKIAIOSFODNN7EXAMPLE" secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" acl: "public-read" } ) { responseResult { success message } } } }`; ``` -------------------------------- ### Helm Install with --set Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Example of installing the Helm chart using the --set argument to override default values. ```console $ helm install --name my-release \ --set postgresql.persistence.enabled=false \ requarks/wiki ``` -------------------------------- ### Example .env File Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example content for a .env file. ```bash ``` -------------------------------- ### system.config Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Example query to retrieve system configuration. ```javascript const query = `{ system { config { title description defaultEditor defaultLocale features { comments search analytics } } } }`; ``` -------------------------------- ### Helm Install with -f values.yaml Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Example of installing the Helm chart using a custom values.yaml file. ```console $ helm install --name my-release -f values.yaml requarks/wiki ``` -------------------------------- ### system.info Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Example query to retrieve system information. ```javascript const query = `{ system { info { version nodeVersion cpuCores hostname platform } } }`; ``` -------------------------------- ### Get Site Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL query to retrieve site configuration details. ```javascript const query = `{ site { config { title description language theme { theme darkMode } features { comments search } } } }`; ``` -------------------------------- ### Get complete site configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL query to retrieve the full site configuration, including title, description, language, features, and theme settings. ```graphql site: SiteQuery config: SiteConfig! ``` ```javascript const query = `{ site { config { title description language features { comments search analytics } theme { theme darkMode } } } }`; ``` -------------------------------- ### system.updateConfig Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Example mutation to update system configuration. ```javascript const mutation = `mutation { system { updateConfig( title: "Company Wiki" description: "Internal documentation" allowUserSignup: false ) { responseResult { success message } } } }`; ``` -------------------------------- ### Local Storage Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the local storage backend. ```javascript { "path": "./assets" // Relative to wiki root } ``` -------------------------------- ### REST Endpoint Examples Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md Examples of how to use cURL to interact with REST API endpoints for listing, getting, and searching pages. ```bash # List pages curl http://localhost:3000/api/pages \ -H "Authorization: Bearer " ``` ```bash # Get single page curl http://localhost:3000/api/pages/42 \ -H "Authorization: Bearer " ``` ```bash # Search pages curl "http://localhost:3000/api/search?q=authentication" \ -H "Authorization: Bearer " ``` -------------------------------- ### DigitalOcean Spaces Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the DigitalOcean Spaces storage backend. ```javascript { "spaceName": "my-space", "region": "nyc3", "accessKey": "...", "secretKey": "...", "endpoint": "https://nyc3.digitaloceanspaces.com" } ``` -------------------------------- ### Example: Get All Comments on a Page Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/comments.md JavaScript example demonstrating how to query for all comments on a specific page. ```javascript const query = `{ comments { list(pageId: 42) { id authorName content createdAt replyTo } } }`; ``` -------------------------------- ### Example en.yml for Localization Source: https://github.com/requarks/wiki/blob/main/server/locales/README.md This example shows how to create a local YAML file to add or override localization keys for testing purposes. ```yml admin: api.title: 'API Access' auth.title: 'Authentication' ``` -------------------------------- ### Get all available locales/languages Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL query to fetch a list of all supported locales and their details. ```graphql locales: [Locale]! ``` ```javascript const query = `{ site { locales { code name nativeName direction } } }`; ``` -------------------------------- ### assets.list GraphQL Query Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/assets.md Example of how to list assets with filtering by folderId and kind. ```graphql assets: AssetQuery list( folderId: Int kind: AssetKind limit: Int offset: Int sort: String filter: String ): AssetListResponse! ``` ```javascript const query = `{ assets { list( folderId: 1 kind: IMAGE limit: 10 ) { assets { id filename mimeType fileSize createdAt } totalCount } } }`; ``` -------------------------------- ### Google Cloud Storage Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the Google Cloud Storage backend. ```javascript { "projectId": "my-project", "keyFilename": "/path/to/key.json", "bucket": "my-bucket" } ``` -------------------------------- ### Backblaze B2 Storage Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the Backblaze B2 storage backend. ```javascript { "accountId": "...", "applicationKey": "...", "bucket": "my-bucket" } ``` -------------------------------- ### GraphQL API Request Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/README.md Example of a curl request to the GraphQL API. ```bash curl -X POST http://localhost:3000/graphql \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "query": "{ pages { list(limit: 5) { id title } } }" }' ``` -------------------------------- ### users.create example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Create a new user account. ```graphql create( email: String! name: String! passwordRaw: String providerKey: String! groups: [Int]! mustChangePassword: Boolean sendWelcomeEmail: Boolean ): UserResponse ``` ```javascript const mutation = `mutation { users { create( email: "user@example.com" name: "John Doe" passwordRaw: "TempPassword123!" providerKey: "local" groups: [1, 2] mustChangePassword: true sendWelcomeEmail: true ) { responseResult { success message } user { id email name } } } }`; ``` -------------------------------- ### Example of creating a page Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md An example JavaScript snippet demonstrating how to use the `create` mutation for pages. ```javascript const mutation = `mutation { pages { create( path: "guides/api" locale: "en" title: "API Guide" description: "Complete API documentation" editor: "markdown" isPublished: true isPrivate: false content: "# API Guide\n\n..." tags: ["documentation", "guide"] ) { responseResult { success message } page { id path } } } }`; ``` -------------------------------- ### Theming Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON object for theming settings. ```json { "theming": { "theme": "dark", "darkMode": true, "customCSS": "", "customLogo": null } } ``` -------------------------------- ### users.single example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Get detailed information for a specific user. ```graphql single( id: Int! ): User ``` ```javascript const query = `{ users { single(id: 5) { id name email isActive isVerified tfaIsActive groups { id name } } } }`; ``` -------------------------------- ### Example: Post a Comment Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/comments.md JavaScript example demonstrating how to post a new comment on a page. ```javascript const mutation = `mutation { comments { create( pageId: 42 content: \"This is very helpful, thank you!\" ) { responseResult { success message } comment { id } } } }`; ``` -------------------------------- ### Logging Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for logger settings. ```json { "logger": { "level": "info", "outputs": ["console", "file"], "file": { "path": "./logs/wiki.log", "maxSize": "10m", "maxFiles": 10 } } } ``` -------------------------------- ### Installing the Chart with Helm 2 Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Installs the Wiki.js chart with the release name 'my-release' using Helm 2. ```console helm install --name my-release requarks/wiki ``` -------------------------------- ### Amazon S3 Storage Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the Amazon S3 storage backend. ```javascript { "bucket": "my-bucket", "region": "us-east-1", "accessKeyId": "AKIA...", "secretAccessKey": "...", "acl": "public-read", "sslEnabled": true, "endpoint": "https://s3.amazonaws.com" } ``` -------------------------------- ### Get site navigation menu structure Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL query to retrieve the hierarchical structure of the site's navigation menu. ```graphql navigation: [NavigationItem] ``` ```javascript const query = `{ site { navigation { id key title icon target order children { id key title } } } }`; ``` -------------------------------- ### Simple Search Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md JavaScript example for performing a simple search query. ```javascript const query = `{ pages { search(query: "getting started") { results { title path description } totalHits } } }`; ``` -------------------------------- ### Microsoft Azure Blob Storage Configuration Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example configuration for the Microsoft Azure Blob Storage backend. ```javascript { "accountName": "myaccount", "accountKey": "...", "container": "assets", "sasExpiry": 3600 } ``` -------------------------------- ### users.profile example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Get the current authenticated user's profile. ```graphql profile: UserProfile ``` ```javascript const query = `{ users { profile { id name email pagesTotal groups } } }`; ``` -------------------------------- ### users.lastLogins example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Get the 10 most recent user logins. ```graphql lastLogins: [UserLastLogin]! ``` -------------------------------- ### Local Storage Backend Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the local storage backend. ```json { "key": "local", "config": { "path": "./assets" } } ``` -------------------------------- ### assets.upload GraphQL Mutation Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/assets.md Example of uploading a new asset file using Apollo Client. ```graphql upload( file: Upload! folderId: Int! ): AssetResponse ``` ```javascript // Using Apollo Client with file upload const mutation = gql` mutation($file: Upload!, $folderId: Int!) { assets { upload(file: $file, folderId: $folderId) { responseResult { success message } asset { id filename url } } } } `; // Call with file client.mutate({ mutation, variables: { file: fileInputElement.files[0], folderId: 1 } }); ``` -------------------------------- ### Example GraphQL Query Request Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md An example using curl to send a GraphQL query for fetching pages. ```bash curl -X POST http://localhost:3000/graphql \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "query": "{ pages { list(limit: 5) { id title path } } }" }' ``` -------------------------------- ### system.info GraphQL Query Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Get system information and version. ```graphql system: SystemQuery info: SystemInfo! ``` -------------------------------- ### Example GraphQL Mutation Request Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md An example using curl to send a GraphQL mutation for creating a page. ```bash curl -X POST http://localhost:3000/graphql \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d '{ "query": "mutation { pages { create(path: \"test\", locale: \"en\", title: \"Test\", description: \"\", editor: \"markdown\", isPublished: true, isPrivate: false, content: \"Test\", tags: []) { responseResult { success message } page { id } } } }" }' ``` -------------------------------- ### GraphQL Authentication Strategies Query Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md Example of how to query for all configured authentication strategies. ```graphql authentication: AuthenticationQuery strategies: [AuthenticationProvider]! ``` ```javascript const query = `{ authentication { strategies { key title displayName isEnabled } } }`; ``` -------------------------------- ### Installing the Chart with Helm 3/4 Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Installs the Wiki.js chart with the release name 'my-release' using Helm 3 or 4. ```console helm install my-release requarks/wiki ``` -------------------------------- ### system.config GraphQL Query Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Get current system configuration. ```graphql config: SystemConfig! ``` -------------------------------- ### Local Authentication Provider Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the local authentication provider. ```json { "key": "local", "strategyKey": "local", "displayName": "Local", "selfRegistration": true, "autoEnlist": true, "config": {} } ``` -------------------------------- ### WebSocket Subscription Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md Example GraphQL subscription query for real-time page change notifications. ```graphql subscription { pageChanged { id title updatedAt } } ``` -------------------------------- ### Security Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON object for security settings. ```json { "security": { "securityTrustProxy": false, "securitySecretKey": "...", "sessionSecret": "...", "bruteForce": { "enabled": true, "attempts": 5, "duration": 900 } } } ``` -------------------------------- ### JWT Token Format Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md Example structure of a JWT token used for authentication. ```json { "alg": "HS256", "typ": "JWT" } { "id": 5, "email": "user@example.com", "name": "User Name", "groups": ["Editors", "Users"], "iat": 1234567890, "exp": 1234654290 } ``` -------------------------------- ### pages.single Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Example JavaScript code to fetch a single page by its ID. ```javascript const query = `{ pages { single(id: 42) { id path title content render tags { tag title } createdAt updatedAt } } }`; ``` -------------------------------- ### Custom CSS Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example mutation to add custom CSS for site theming. ```javascript const mutation = `mutation { site { updateTheme( customCSS: " :root { --primary-color: #2196F3; } .navbar { background-color: var(--primary-color); } " ) { responseResult { success } } } }`; ``` -------------------------------- ### users.list example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Retrieve all users with minimal information. ```graphql users: UserQuery list( filter: String orderBy: String ): [UserMinimal]! ``` ```javascript const query = `{ users { list { id name email providerKey isActive createdAt } } }`; ``` -------------------------------- ### Search with Filters Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md JavaScript example for performing a search with filters like locale and path. ```javascript const query = `{ pages { search( query: "api" locale: "en" path: "documentation/*" ) { results { id title path } suggestions } } }`; ``` -------------------------------- ### Authorization - Permission Check Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/errors.md Example of checking user permissions before performing an action, throwing a specific error if unauthorized. ```javascript if (!WIKI.auth.checkAccess(user, ['read:pages'], { path: page.path })) { throw new WIKI.Error.PageViewForbidden() } ``` -------------------------------- ### GraphQL Search Query Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md An example GraphQL query for performing a full-text search on pages. ```graphql { pages { search(query: "authentication") { results { id title path } totalHits } } } ``` -------------------------------- ### pages.singleByPath Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Example JavaScript code to fetch a single page using its path and locale. ```javascript const query = `{ pages { singleByPath( path: "guides/setup" locale: "en" ) { id title content isPublished } } }`; ``` -------------------------------- ### Add Top-Level Navigation Item Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example mutation to create a top-level navigation item. ```javascript const mutation = `mutation { navigation { create( key: "docs" title: "Documentation" target: "documentation" icon: "mdi-file-document" order: 1 ) { responseResult { success } } } }`; ``` -------------------------------- ### LDAP Provider Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the LDAP authentication provider. ```json { "key": "ldap", "strategyKey": "ldapauth", "displayName": "LDAP", "config": { "url": "ldap://ldap.example.com", "bindDN": "cn=admin,dc=example,dc=com", "bindCredentials": "password", "searchBase": "dc=example,dc=com", "searchFilter": "(&(uid={{username}}))", "mailAttribute": "mail" } } ``` -------------------------------- ### Get System Version Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Retrieves the system version, platform, and Node.js version. ```javascript const query = `{ system { info { version platform nodeVersion } } }`; ``` -------------------------------- ### Feature Toggles JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON object for feature flags. ```json { "features": { "comments": true, "search": true, "analytics": true, "api": true, "offline": true } } ``` -------------------------------- ### GraphQL Query for Storage Targets Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example of a GraphQL query to retrieve all configured storage targets. ```graphql storage: StorageQuery targets: [StorageTarget]! ``` ```javascript const query = `{ storage { targets { key title isEnabled order config { path } } } }`; ``` -------------------------------- ### Update site configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL mutation to update various site configuration settings, including title, description, language, features, and theme. ```graphql updateConfig( title: String description: String language: String features: SiteFeaturesInput theme: SiteThemeInput ): DefaultResponse ``` ```javascript const mutation = `mutation { site { updateConfig( title: "Company Wiki" description: "Team knowledge base" language: "en" features: { comments: true search: true analytics: false } ) { responseResult { success message } } } }`; ``` -------------------------------- ### Azure Search Engine Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Azure Search engine. ```json { "key": "azure", "config": { "serviceName": "myservice", "key": "...", "indexName": "wiki" } } ``` -------------------------------- ### GitHub OAuth Provider Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the GitHub OAuth authentication provider. ```json { "key": "github", "strategyKey": "github-oauth2", "displayName": "GitHub", "config": { "clientId": "...", "clientSecret": "...", "callbackURL": "http://localhost:3000/auth/callback/github" } } ``` -------------------------------- ### GraphQL Error Response Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/errors.md Example of how GraphQL errors are returned in the response, including message and extensions with error code. ```json { "data": null, "errors": [ { "message": "You are not authorized to delete this page.", "extensions": { "code": "PageDeleteForbidden", "exception": { "errorCode": 6010 } } } ] } ``` -------------------------------- ### SAML 2.0 Provider Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the SAML 2.0 authentication provider. ```json { "key": "saml", "strategyKey": "saml", "displayName": "SAML", "config": { "entryPoint": "https://idp.example.com/sso", "issuer": "wiki", "cert": "...", "identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" } } ``` -------------------------------- ### Custom Footer Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example mutation to update site configuration, potentially for a custom footer. ```javascript const mutation = `mutation { site { updateConfig( title: "Wiki" description: "Our Wiki" ) { responseResult { success } } } }`; ``` -------------------------------- ### Google Cloud Storage Backend Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Google Cloud Storage backend. ```json { "key": "gcs", "config": { "projectId": "...", "keyFilename": "/path/to/key.json", "bucket": "my-bucket" } } ``` -------------------------------- ### Deploy with existing secret Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Example of creating a Kubernetes secret for PostgreSQL credentials and deploying the Helm chart using it. ```bash # Create your existing secret kubectl create secret generic my-postgres-secret \ --from-literal=postgresql-username=postgres \ --from-literal=postgresql-password=yourpassword # Deploy with existing secret helm install my-release requarks/wiki \ --set postgresql.enabled=true \ --set postgresql.existingSecret=my-postgres-secret ``` -------------------------------- ### Get Application URL Source: https://github.com/requarks/wiki/blob/main/dev/helm/templates/NOTES.txt Commands to retrieve the application's URL based on Ingress or Service type. ```go-template {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "wiki.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "wiki.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "wiki.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}) echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "wiki.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 {{- end }} ``` -------------------------------- ### Get all page tags Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Retrieves all available page tags in the system. ```graphql tags: [PageTag]! ``` -------------------------------- ### users.search example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Search users by name or email. ```graphql search( query: String! ): [UserMinimal]! ``` -------------------------------- ### Google OAuth Provider Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Google OAuth authentication provider. ```json { "key": "google", "strategyKey": "google-oauth2", "displayName": "Google", "config": { "clientId": "...", "clientSecret": "...", "callbackURL": "http://localhost:3000/auth/callback/google" } } ``` -------------------------------- ### GraphQL Query Pattern Source: https://github.com/requarks/wiki/blob/main/_autodocs/README.md Example of a JavaScript fetch request for a GraphQL query. ```javascript const query = `{ pages { list(limit: 10) { id path title isPublished } } }`; const response = await fetch('/graphql', { method: 'POST', headers: { 'Authorization': `Bearer ${jwtToken}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query }) }); const data = await response.json(); ``` -------------------------------- ### system.flags GraphQL Query Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Get current feature flags. ```graphql flags: [SystemFlag]! ``` -------------------------------- ### Solr Search Engine Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Solr search engine. ```json { "key": "solr", "config": { "host": "http://localhost:8983", "core": "wiki" } } ``` -------------------------------- ### Elasticsearch Search Engine Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Elasticsearch search engine. ```json { "key": "elasticsearch", "config": { "host": "localhost:9200", "username": "elastic", "password": "...", "indexName": "wiki" } } ``` -------------------------------- ### Add Nested Navigation Item Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example mutation to create a nested navigation item. ```javascript const mutation = `mutation { navigation { create( parentId: 1 key: "guide-api" title: "API Guide" target: "documentation/api" icon: "mdi-api" order: 2 ) { responseResult { success } } } }`; ``` -------------------------------- ### Azure Blob Storage Backend Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Azure Blob Storage backend. ```json { "key": "azure", "config": { "accountName": "myaccount", "accountKey": "...", "container": "assets" } } ``` -------------------------------- ### Update Site Title and Description Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL mutation to update the site's title and description. ```javascript const mutation = `mutation { site { updateConfig( title: "New Wiki Title" description: "Updated description" ) { responseResult { success message } } } }`; ``` -------------------------------- ### GraphQL Mutation Pattern Source: https://github.com/requarks/wiki/blob/main/_autodocs/README.md Example of a JavaScript fetch request for a GraphQL mutation. ```javascript const mutation = ` mutation { pages { create( path: "guides/api" locale: "en" title: "API Guide" description: "API reference" editor: "markdown" isPublished: true isPrivate: false content: "# API Guide..." tags: ["api", "guide"] ) { responseResult { success message } page { id path } } } } `; ``` -------------------------------- ### Local Storage Asset URL Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example URL format for assets stored locally. ```plaintext /assets/folder/filename.jpg ``` -------------------------------- ### Wildcards Search Syntax Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md Examples of using wildcard characters in search queries. ```plaintext auth* - Prefix match (auth, authentication, authorize) *manager - Suffix match (user manager, page manager) aut?mor - Single character wildcard ``` -------------------------------- ### Backup Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Creates a database backup. ```javascript const mutation = `mutation { system { backup { responseResult { success } } } }`; ``` -------------------------------- ### Add navigation menu item Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL mutation to create a new navigation menu item, with options for parent ID, key, title, target, icon, and order. ```graphql create( parentId: Int key: String! title: String! target: String! icon: String order: Int ): NavigationResponse ``` ```javascript const mutation = `mutation { navigation { create( key: "docs-guide" title: "Getting Started" target: "guides/getting-started" icon: "mdi-book-open" order: 1 ) { responseResult { success } navigationItem { id key title } } } }`; ``` -------------------------------- ### Use API Key with cURL Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md Example of how to include an API key in the Authorization header for cURL requests. ```bash curl -H "Authorization: Bearer " \ http://localhost:3000/graphql ``` -------------------------------- ### Amazon S3 Storage Backend Configuration JSON Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Example JSON for the Amazon S3 storage backend. ```json { "key": "s3", "config": { "bucket": "my-bucket", "region": "us-east-1", "accessKeyId": "...", "secretAccessKey": "...", "acl": "public-read" } } ``` -------------------------------- ### Update site theme and appearance Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL mutation to modify the site's theme, dark mode setting, and custom CSS. ```graphql updateTheme( theme: String darkMode: Boolean customCSS: String ): DefaultResponse ``` -------------------------------- ### pages.search Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Example JavaScript code to search for pages. ```javascript const query = `{ pages { search( query: "authentication" locale: "en" ) { results { id title path description } suggestions totalHits } } }`; ``` -------------------------------- ### Mounting CAs and setting nodeExtraCaCerts Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Example of mounting CAs from a ConfigMap to the Wiki.js pod and setting the `nodeExtraCaCerts` Helm variable. ```yaml volumeMounts: - name: ca mountPath: /cas.pem subPath: certs.pem volumes: - name: ca configMap: name: ca nodeExtraCaCerts: "/cas.pem" ``` -------------------------------- ### JWT Token Validation Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md JavaScript code snippet demonstrating JWT token validation. ```javascript const decoded = jwt.verify(token, SECRET) context.req.user = decoded ``` -------------------------------- ### REST Local Login Response Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md Example JSON response body for a successful local login. ```json { "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "redirect": "/" } ``` -------------------------------- ### pages.list Example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Example JavaScript code to query a paginated list of pages. ```javascript const query = `{ pages { list( limit: 10 locale: "en" orderBy: CREATED orderByDirection: DESC ) { id path title locale isPublished createdAt updatedAt } } }`; ``` -------------------------------- ### Extra Trusted Certificates ConfigMap Source: https://github.com/requarks/wiki/blob/main/dev/helm/README.md Example of creating a ConfigMap to store extra CA certificates in PEM format. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: ca namespace: your-wikijs-namespace data: certs.pem: |- -----BEGIN CERTIFICATE----- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -----END CERTIFICATE----- ``` -------------------------------- ### File Upload via GraphQL Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md Example using curl for file uploads to the GraphQL endpoint using multipart/form-data. ```bash curl -X POST http://localhost:3000/graphql \ -H "Authorization: Bearer " \ -F operations='{ "query": "mutation($file: Upload!) { assets { upload(file: $file, folderId: 1) { responseResult { success } asset { id } } } }", "variables": { "file": null } }' \ -F map='{ "0": ["variables.file"] }' \ -F 0=@/path/to/file.jpg ``` -------------------------------- ### GraphQL Mutation to Update Storage Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Example of a GraphQL mutation to update the configuration of a storage target, specifically for S3. ```graphql updateConfig( key: String! config: JSON! ): DefaultResponse ``` ```javascript const mutation = `mutation { storage { updateConfig( key: "s3" config: { bucket: "wiki-assets" region: "us-east-1" accessKeyId: "AKIA..." secretAccessKey: "wJal..." } ) { responseResult { success message } } } }`; ``` -------------------------------- ### Error Catching in GraphQL Client Source: https://github.com/requarks/wiki/blob/main/_autodocs/errors.md Example of catching and handling errors from a GraphQL client, specifically checking for error codes. ```javascript client.mutate({ mutation: CREATE_PAGE, variables: { /* ... */ } }).catch(err => { const errors = err.graphQLErrors || [] errors.forEach(e => { const code = e.extensions?.exception?.errorCode if (code === 6002) { console.error('Page already exists') } }) }) ``` -------------------------------- ### MySQL/MariaDB Database Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Configuration details for connecting to a MySQL or MariaDB database. ```bash DB=mysql DB_HOST=localhost DB_PORT=3306 DB_USER=wiki DB_PASS=wikipassword DB_NAME=wiki ``` -------------------------------- ### SQLite Database Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Configuration details for using SQLite as the database. ```bash DB=sqlite DB_FILENAME=wiki.db ``` -------------------------------- ### Run Migrations Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Runs database migrations. ```javascript const mutation = `mutation { system { database { migrate { responseResult { success } } } } }`; ``` -------------------------------- ### PostgreSQL Database Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Configuration details for connecting to a PostgreSQL database. ```bash DB=postgres DB_HOST=localhost DB_PORT=5432 DB_USER=wiki DB_PASS=wikipassword DB_NAME=wiki ``` -------------------------------- ### users.update example Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/users.md Update user account details. ```graphql update( id: Int! email: String name: String newPassword: String groups: [Int] location: String jobTitle: String timezone: String dateFormat: String appearance: String ): DefaultResponse ``` -------------------------------- ### Proxy Configuration Environment Variables Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Environment variables for proxy settings. ```bash HTTP_PROXY=http://proxy:8080 HTTPS_PROXY=http://proxy:8080 NO_PROXY=localhost,127.0.0.1 ``` -------------------------------- ### Reindex on Demand Mutation Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md JavaScript example for triggering a search reindex. ```javascript const mutation = `mutation { search { reindex { responseResult { success message } } } }`; ``` -------------------------------- ### MongoDB Environment Variables Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Environment variables for MongoDB connection. ```bash DB=mongodb DB_HOST=localhost DB_PORT=27017 DB_USER=wiki DB_PASS=wikipassword DB_NAME=wiki ``` -------------------------------- ### Field Search Syntax Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md Examples of searching within specific fields. ```plaintext title:authentication - Search in title path:guides/* - Search in specific paths ``` -------------------------------- ### Configuration Validation Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md The system validates configuration on startup by calling the `validate()` method on the `configSvc` service. ```javascript WIKI.configSvc.validate() // Validates current config ``` -------------------------------- ### CORS Configuration - Disabled Source: https://github.com/requarks/wiki/blob/main/_autodocs/endpoints.md Example of disabling CORS by default in server/master.js. ```javascript // In server/master.js app.use(cors({ origin: false })) ``` -------------------------------- ### SQL Server (MSSQL) Database Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/configuration.md Configuration details for connecting to a SQL Server (MSSQL) database. ```bash DB=mssql DB_HOST=localhost DB_PORT=1433 DB_USER=sa DB_PASS=wikipassword DB_NAME=wiki ``` -------------------------------- ### Basic Terms Search Syntax Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md Examples of basic search query patterns. ```plaintext authentication - Find pages containing "authentication" "login flow" - Exact phrase search wiki setup - Multiple terms (AND) ``` -------------------------------- ### Search for tags by prefix Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/pages.md Searches for tags that start with a given query string. ```graphql searchTags( query: String! ): [String]! ``` -------------------------------- ### Permission Strings Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md A list of available permission strings and their descriptions. ```text manage:system - Full system access manage:api - Manage API keys manage:users - Manage user accounts manage:groups - Manage user groups manage:pages - Manage all pages manage:navigation - Edit site navigation manage:comments - Moderate comments read:pages - View published pages read:source - View page source/raw content read:assets - Access assets/attachments read:history - View page history read:comments - View comments write:pages - Create and edit pages write:assets - Upload files write:comments - Post comments write:auth - Configure authentication write:profile - Edit own profile write:groups - Create/edit groups delete:pages - Delete pages delete:assets - Delete files delete:comments - Delete comments select:editors - Switch between page editors ``` -------------------------------- ### Update Wiki Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Updates the wiki configuration with a new title, description, and default locale. ```javascript const mutation = `mutation { system { updateConfig( title: "My Wiki" description: "Team knowledge base" defaultLocale: "en" ) { responseResult { success message } } } }`; ``` -------------------------------- ### Boolean Operators Search Syntax Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/search.md Examples of using boolean operators in search queries. ```plaintext authentication OR login - Either term authentication AND setup - Both terms authentication NOT oauth - Exclude term ``` -------------------------------- ### system.ssl GraphQL Query Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/system.md Manage SSL/TLS certificates. ```graphql ssl: SystemSSL ``` -------------------------------- ### Auto-Enlistment Configuration Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md JSON configuration for enabling auto-enlistment of new users from OAuth/SAML and assigning them to specific groups. ```json { "autoEnlist": true, "autoEnlistGroups": [1, 3] // Auto-assign to these groups } ``` -------------------------------- ### REST Two-Factor Authentication Request Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/authentication.md Example JSON request body for two-factor authentication. ```json { "loginToken": "token_from_initial_login", "securityCode": "123456" } ``` -------------------------------- ### Local Storage Backup Command Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/storage.md Bash command for daily backup of the assets directory. ```bash # Daily backup of assets directory 0 2 * * * tar -czf /backup/assets-$(date +\%Y\%m\%d).tar.gz /wiki/assets ``` -------------------------------- ### Change default locale Source: https://github.com/requarks/wiki/blob/main/_autodocs/api-reference/site.md Example GraphQL mutation to update the default locale for the site. ```graphql updateLocale( locale: String! ): DefaultResponse ```