Create a Langvar

Endpoint Overview

Language variables (langvars) are used to store text content that appears on your storefront and administration panel in different languages. This endpoint allows you to create new language variables for either the default language or a specific language.

POST /api/langvars/

Creates a language variable for the default language.

Note: The default language is the Backend default language configured under Settings → Appearance.
POST /api/languages/{lang_id}/langvars/

Creates a language variable for a specific language.

Path Parameters

Parameter Type Description
lang_id integer The ID of the language for which to create the variable.
Alternative Approach: You can also specify the language using a query parameter like:
POST /api/langvars/?sl=en

Request Parameters

Pass the following parameters in the HTTP request body according to your specified Content-Type:

Parameter Type Required Description
name* string Yes The internal name of the language variable in Venddor. This is the identifier used when retrieving this variable via the API.
value string No The actual text that people will see on the storefront or in the Administration panel.
Tip: Use numbers, underscores, and lowercase letters of the ISO basic Latin alphabet for the name of the language variable. This ensures compatibility and easier management.

Example Request

{
  "name": "test_variable",
  "value": "This is the text that will appear instead of the language variable for the specified language."
}

Response Format

Success Response (201 Created)

{
  "name": "test_variable"
}

Error Response (400 Bad Request)

Returned when the language variable couldn't be created due to invalid parameters or other issues.

Implementation Notes

When creating language variables, consider the following best practices:

Important: If you're creating multiple related language variables, ensure consistent terminology across them for a professional user experience.