> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QuerySchemas # Package: translation # Namespace: TranslationSchema # Method link: https://dev.wix.com/docs/api-reference/business-management/multilingual/translation/translation-schema/query-schemas.md ## Permission Scopes: Wix Multilingual - Translation Schema Read: SCOPE.DC-MULTILINGUAL.READ_TRANSLATION_SCHEMA ## Introduction Retrieves a list of schemas, given the provided paging, filtering, and sorting. Up to 100 schemas can be returned per request. > **Note:** > > This method can retrieve all schemas with a `GLOBAL` scope and schemas with a `SITE` scope for the site the API request is authorized to access. The default `sort` is `id` in `ASC`. To learn how to query translation schemas, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md). --- ## REST API ### Schema ``` Method: querySchemas Description: Retrieves a list of schemas, given the provided paging, filtering, and sorting. Up to 100 schemas can be returned per request. > **Note:** > > This method can retrieve all schemas with a `GLOBAL` scope and schemas with a `SITE` scope for the site the API request is authorized to access. The default `sort` is `id` in `ASC`. To learn how to query translation schemas, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md). URL: https://www.wixapis.com/v1/schemas/query Method: POST Method parameters: param name: query | type: CursorQuery - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section). - name: sort | type: array | description: Sort object. Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QuerySchemasResponse - name: schemas | type: array | description: List of translation schemas. - name: id | type: string | description: Translation schema GUID. - name: key | type: SchemaKey | description: Translation schema unique key identifier. - name: appId | type: string | description: GUID of the app that created the schema. - name: entityType | type: string | description: A unique name defined by the app developer to differentiate translation schemas for various entities within their app. For example, if an app developer is creating a translation schema for blog posts, the `entityType` can be `'blog-posts'`. - name: scope | type: SchemaScope | description: Scope of the translation schema. - enum: - GLOBAL: Global schema for all sites. - SITE: Custom schema for a specific site. - name: fields | type: Map | description: List of fields for the translation schema. This property uses a string to map to a `SchemaField` (`Map`). The string serves as a key, which you'll need to access each field in the schema and when adding translation content. - name: id | type: string | description: Field GUID. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field GUIDs may contain parentheses to reference repeated items, such as images. These parentheses can't be nested and each opening parenthesis must be followed by a closing one. For example, `title()()` is valid, while `title)(` and `title(())` aren't valid. The value inside the parenthesis is validated according to Regex `^[^)(\\]\\[\\.]+$`. - name: type | type: FieldType | description: **Required.** Field type. - enum: - SHORT_TEXT: Short plain text displayed as a single line in the UI. - LONG_TEXT: Long plain text displayed as multiple lines in the UI. - HTML: Long text including styles, images, and links. - RICH_CONTENT: Rich-Content using the Wix Ricos format. - IMAGE: Wix Media Manager image. - IMAGE_LINK: Image URL without metadata. - VIDEO: Wix Media Manager video. - DOCUMENT: Wix Media Manager document. - name: displayName | type: string | description: Field name displayed in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager). - name: groupName | type: string | description: Field group name. - name: minLength | type: integer | description: Field minimum text length. - name: maxLength | type: integer | description: Field maximum text length. - name: format | type: string | description: Field format. Content is validated based on the format set here in the field schema. For example, if the format is `EMAIL`, then the content for this field must be a valid email address. - name: hidden | type: boolean | description: Whether the field is hidden from the site. Hidden fields are still validated. - name: displayOnly | type: boolean | description: Whether the field is read-only, and not intended to be translated. For example, an image. Use this field when you want an image to remain in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) for context, but without being translated. - name: index | type: number | description: Field index. Use for cases where the order of the fields are relevant. - name: previewFields | type: PreviewFields | description: Fields displayed in content previews. For example, a product name for a product translation schema. - name: titleFieldId | type: string | description: GUID of the field representing the schema's title. - name: imageFieldId | type: string | description: GUID of the field representing the schema's image. - name: hidden | type: boolean | description: Whether the translation schema is hidden from the site. Default: `false` - name: displayName | type: string | description: Translation schema name displayed in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager). - name: parentId | type: string | description: A reference to the parent schema. For example, if the schema is for a menu item, this property would contain the schema GUID of the menu it belongs to. Required when `require_parent_entity` is set to `true`. - name: revision | type: string | description: Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing `revision` must be used when updating a schema. - name: createdDate | type: string | description: Date and time the translation schema was created. - name: updatedDate | type: string | description: Date and time the translation schema was updated. - name: duplicateContent | type: boolean | description: Whether to duplicate the translated content when a site containing the translation schema and content is duplicated. Default: `false` - name: requireParentEntity | type: boolean | description: Whether content created or updated with this schema must include a `parent_entity_id`. When set to `true`, any Create Content or Update Content call targeting this schema will fail if `parent_entity_id` is missing or empty. The schema itself must also have a `parent_id` defined, otherwise the schema Create or Update call will fail with `SchemaRequireParentEntityWithoutParentIdException`. Default: `false` Example: A "menu-item" schema that always belongs to a "menu" parent schema would set `require_parent_entity = true` and `parent_id` to the "menu" schema GUID. Every translation content item created for "menu-item" must then specify which menu it belongs to via `parent_entity_id`. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata for the next page of results. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### Query Schema ```curl curl -X POST \ 'https://www.wixapis.com/translation-schema/v1/schemas/query' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ --data-binary '{ "query": { "filter": { "key.appId": "4ad2dfe1-a943-45a8-94ac-f1dd8b78821b" }, } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.translation.TranslationSchema.querySchemas(query) Description: Retrieves a list of schemas, given the provided paging, filtering, and sorting. Up to 100 schemas can be returned per request. > **Note:** > > This method can retrieve all schemas with a `GLOBAL` scope and schemas with a `SITE` scope for the site the API request is authorized to access. The default `sort` is `id` in `ASC`. To learn how to query translation schemas, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: SchemaQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section). - name: sort | type: array | description: Sort object. Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: schemas | type: array | description: List of translation schemas. - name: _id | type: string | description: Translation schema GUID. - name: key | type: SchemaKey | description: Translation schema unique key identifier. - name: appId | type: string | description: GUID of the app that created the schema. - name: entityType | type: string | description: A unique name defined by the app developer to differentiate translation schemas for various entities within their app. For example, if an app developer is creating a translation schema for blog posts, the `entityType` can be `'blog-posts'`. - name: scope | type: SchemaScope | description: Scope of the translation schema. - enum: - GLOBAL: Global schema for all sites. - SITE: Custom schema for a specific site. - name: fields | type: Map | description: List of fields for the translation schema. This property uses a string to map to a `SchemaField` (`Map`). The string serves as a key, which you'll need to access each field in the schema and when adding translation content. - name: _id | type: string | description: Field GUID. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field GUIDs may contain parentheses to reference repeated items, such as images. These parentheses can't be nested and each opening parenthesis must be followed by a closing one. For example, `title()()` is valid, while `title)(` and `title(())` aren't valid. The value inside the parenthesis is validated according to Regex `^[^)(\\]\\[\\.]+$`. - name: type | type: FieldType | description: **Required.** Field type. - enum: - SHORT_TEXT: Short plain text displayed as a single line in the UI. - LONG_TEXT: Long plain text displayed as multiple lines in the UI. - HTML: Long text including styles, images, and links. - RICH_CONTENT: Rich-Content using the Wix Ricos format. - IMAGE: Wix Media Manager image. - IMAGE_LINK: Image URL without metadata. - VIDEO: Wix Media Manager video. - DOCUMENT: Wix Media Manager document. - name: displayName | type: string | description: Field name displayed in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager). - name: groupName | type: string | description: Field group name. - name: minLength | type: integer | description: Field minimum text length. - name: maxLength | type: integer | description: Field maximum text length. - name: format | type: string | description: Field format. Content is validated based on the format set here in the field schema. For example, if the format is `EMAIL`, then the content for this field must be a valid email address. - name: hidden | type: boolean | description: Whether the field is hidden from the site. Hidden fields are still validated. - name: displayOnly | type: boolean | description: Whether the field is read-only, and not intended to be translated. For example, an image. Use this field when you want an image to remain in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) for context, but without being translated. - name: index | type: number | description: Field index. Use for cases where the order of the fields are relevant. - name: previewFields | type: PreviewFields | description: Fields displayed in content previews. For example, a product name for a product translation schema. - name: titleFieldId | type: string | description: GUID of the field representing the schema's title. - name: imageFieldId | type: string | description: GUID of the field representing the schema's image. - name: hidden | type: boolean | description: Whether the translation schema is hidden from the site. Default: `false` - name: displayName | type: string | description: Translation schema name displayed in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager). - name: parentId | type: string | description: A reference to the parent schema. For example, if the schema is for a menu item, this property would contain the schema GUID of the menu it belongs to. Required when `require_parent_entity` is set to `true`. - name: revision | type: string | description: Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing `revision` must be used when updating a schema. - name: _createdDate | type: Date | description: Date and time the translation schema was created. - name: _updatedDate | type: Date | description: Date and time the translation schema was updated. - name: duplicateContent | type: boolean | description: Whether to duplicate the translated content when a site containing the translation schema and content is duplicated. Default: `false` - name: requireParentEntity | type: boolean | description: Whether content created or updated with this schema must include a `parent_entity_id`. When set to `true`, any Create Content or Update Content call targeting this schema will fail if `parent_entity_id` is missing or empty. The schema itself must also have a `parent_id` defined, otherwise the schema Create or Update call will fail with `SchemaRequireParentEntityWithoutParentIdException`. Default: `false` Example: A "menu-item" schema that always belongs to a "menu" parent schema would set `require_parent_entity = true` and `parent_id` to the "menu" schema GUID. Every translation content item created for "menu-item" must then specify which menu it belongs to via `parent_entity_id`. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata for the next page of results. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### querySchemas ```javascript import { translationSchemas } from '@wix/multilingual'; async function querySchemas(query) { const response = await translationSchemas.querySchemas(query); }; ``` ### querySchemas (with elevated permissions) ```javascript import { translationSchemas } from '@wix/multilingual'; import { auth } from '@wix/essentials'; async function myQuerySchemasMethod(query) { const elevatedQuerySchemas = auth.elevate(translationSchemas.querySchemas); const response = await elevatedQuerySchemas(query); } ``` ### querySchemas (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { translationSchemas } from '@wix/multilingual'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { translationSchemas }, // Include the auth strategy and host as relevant }); async function querySchemas(query) { const response = await myWixClient.translationSchemas.querySchemas(query); }; ``` ---