Languages

Managing Languages via Venddor IO API

The Venddor IO API provides a straightforward mechanism to manage and interact with the languages installed on your platform. Here's an overview of how you can leverage this API for various language-related tasks.

API Endpoints for Languages:

  1. Listing All Installed Languages:

    URL: http://example.com/api/languages/

    Action: Fetches the list of all installed languages and their details.

    Method: GET

Pagination:

For efficient viewing and retrieval, you can use pagination parameters to specify how many languages should be returned and in what order.

Parameter Default Value Description
page 1 Page number
items_per_page 10 Number of items per page

For instance, to fetch two languages from the second page: GET /api/languages/?page=2&items_per_page=2.

Sample Response:

When you send a GET request to /api/languages/, you can expect a JSON response with details about the installed languages:

{
  "languages": {
    "en": {
      "lang_id": "1",
      "lang_code": "en",
      ...
    },
    "ru": {
      ...
    }
  },
  ...
}

Fetching Specific Language Details:

To access details of a particular language, use its unique identifier:

URL: GET /api/languages/1/

If the language exists, you'll get its details; otherwise, a 404 Not Found response will be returned.

Language Attributes:

Each language is represented by several attributes or fields. Here's a breakdown:

Field Description
lang_id Unique identifier of the language.
lang_code A two-letter code representing the language, e.g., 'en' for English.
name Descriptive name of the language.
... Other attributes...

Adding a New Language:

To introduce a new language to Venddor IO:

URL: POST /api/languages/

You'll need to provide necessary details like lang_code, name, and so on. Here's a sample payload:

{
  "lang_code": "ts",
  "name": "Test",
  ...
}

On successful creation, you'll get a confirmation along with the language's ID.

Updating Language Details:

To modify the details of an existing language:

URL: PUT /api/languages/3/

Ensure you provide the necessary details, especially the lang_code, in the request.

Deleting a Language:

Languages can be removed using the DELETE method:

URL: DELETE /api/languages/3/

You cannot delete a language set as the Backend default language.

Summary:

Venddor IO's module-based approach allows you to manage languages seamlessly, ensuring that your platform caters to a global audience. By utilising the described API endpoints, developers and administrators can have better control over multilingual support and provide a richer user experience.