Skip to content

API Country

Nastya Birillo edited this page Dec 7, 2020 · 5 revisions

Table of Contents

Description

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

Model

Model description

Field Type Description
key String the country key. It must be unique
en String country in English
... String country in the different languages

The public fields of settings:

Field Type Description
key String the country key. It must be unique
translation List of objects country in different languages. Seen an example of the response bellow

Available languages:

  • en - English
  • ru - Russian

An example of the response

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

Routes

Create a country

Route

URL Type Description
/api/country POST create a new country in the database

The query body

Parameter Type Description
key String key of the country. It must be unique in the database
descriptions List of objects description of the country in the different languages

An example of the query body

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

Response

The public fields of the country.


Get all countries

Route

URL Type Description
/api/country/all GET get all countries

The query body

Empty body.

Response

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


Get the country

Route

URL Type Description
/api/country/:key GET get country by key

The query body

Empty body.

Response

The public fields of the country.


Delete the country

Route

URL Type Description
/api/country/:key DELETE delete country by key

The query body

Empty body.

Response

The public fields of the country.