Skip to content

API Country

Elena edited this page Mar 31, 2021 · 5 revisions

Table of Contents

Description

Countries for UI panels in different languages for the TaskTracker plugin.

Model

Field Type Description
key String Country key. Must be unique.
{lng_key} String Country name in the language specified by the interface language key (en, ru, de, and others). For example, en stands for a country name in English.

Public fields

Field Type Description
key String Country key. Must be unique.
translation Array Country names in different languages. See a response example below.

Available languages:

  • en - English
  • ru - Russian

Response example

{
    "key": "russia",
    "translation": 
    [
      { "key":"en" },
      "Russia",
      { "key":"ru" },
      "Россия"
    ]
}

Operations

Create a country

Operation

Endpoint Method Description
/api/country POST Create a new country in the database.

Request parameters

Parameter Type Description
key String Key of the country. Must be unique in the database.
descriptions Array Names of the country in different languages.

Request example

{
  "key": "russia",
  "descriptions": 
  [
    {
      "language": "en",
      "value": "Russia"
    },
    {
      "language": "ru",
      "value": "Россия"
    }
  ]
}

Response

Public fields of the country.


Get all countries

Operation

Endpoint Method Description
/api/country/all GET Get all countries.

Request parameters

Empty body.

Response

List of the countries. Each country has the public fields of the country model.


Get the country

Operation

Endpoint Method Description
/api/country/:key GET Get a country by its key.

Request parameters

Empty body.

Response

Public fields of the country.


Delete the country

Operation

Endpoint Method Description
/api/country/:key DELETE Delete a country by its key.

Request parameters

Empty body.

Response

Public fields of the country.