MedDict-VinUni Backend API
1.1

Base URL
http://localhost:5000

API for MedDict-VinUni Backend.

This is version 1.1 of this API documentation. Last update on Jan 14, 2024.

This API is provided under license MIT License.

Servers

Base URL Description
http://localhost:5000 Local development API
https://api.meddict-vinuni.com Production API

Authentication

words

API related to the words in the dictionary.

Retrieve words from MedDict Database from pattern

GET /words

Get results of word from input, which included the definitions, illustration, etc. The pattern follows the following Regular Expression

import re 
pattern = f"^.*{pattern}.*$"

Which means it will match any word that INCLUDES the pattern.

Query parameters

  • lang string Required

    Source language to search the pattern on.

    Values are en or vn.

  • word string Required

    The pattern to search for.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id integer
    • en string
    • en_type string
    • vn string
    • vn_type string
  • 400

    The request is not following the convention.

GET /words
curl \
 -X GET http://localhost:5000/words?lang=en&word=abdominal
Response examples (200)
[
  {
    "en": "abdominal pressure",
    "en_type": "n",
    "id": 8,
    "vn": "áp lực khoang bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal aorta",
    "en_type": "n",
    "id": 1,
    "vn": "động mạch chủ bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal aortic aneurysm",
    "en_type": "n",
    "id": 2,
    "vn": "phình động mạch chủ bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal cavity",
    "en_type": "n",
    "id": 3,
    "vn": "khoang ổ bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal decompression",
    "en_type": "n",
    "id": 4,
    "vn": "giải áp khoang bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal esophagus",
    "en_type": "n",
    "id": 5,
    "vn": "thực quản vùng bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal peritoneum",
    "en_type": "n",
    "id": 7,
    "vn": "phúc mạc bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "abdominal paracentesis",
    "en_type": "n",
    "id": 6,
    "vn": "chọc dò ổ bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "extra-abdominal",
    "en_type": "a",
    "id": 2452,
    "vn": "ngoài bụng",
    "vn_type": "tính từ"
  },
  {
    "en": "intra-abdominal abscess",
    "en_type": "n",
    "id": 5515,
    "vn": "áp-xe bụng trong bụng",
    "vn_type": "danh từ"
  },
  {
    "en": "tuboabdominal pregnancy",
    "en_type": "n",
    "id": 8727,
    "vn": "mang thai lạc vị vòi tử cung-ổ bụng",
    "vn_type": "danh từ"
  }
]

Update a word in the database.

PUT /words

Update a word in the database manually.

application/json

Body Required

The description of the word to be updated. Except the id, all other fields are optional.

If the field is provided, it will be overwritten with the data in the dictionary. However, if the field is not provided, the old data will not be changed.

  • id integer
  • en string
  • en_type string
  • vn string
  • vn_type string

Responses

  • 200

    OK

  • 400

    The request is not following the convention.

  • 403

    The user is not authorized to update a word (aka. not admin).

  • 404

    The word id's is not found.

  • 500

    Unknown error.

PUT /words
curl \
 -X PUT http://localhost:5000/words \
 --cookie "fastapiusersauth=$API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"id":1337,"en":"Software Construction","en_type":"n","vn":"Xây dựng phần mềm","vn_type":"danh từ"}'
Request example
{
  "id": 1337,
  "en": "Software Construction",
  "en_type": "n",
  "vn": "Xây dựng phần mềm",
  "vn_type": "danh từ"
}

Create a new word in the database.

POST /words

Create a new word in the database manually.

application/json

Body Required

The word to be created, based on the following example

  • en string
  • en_type string
  • vn string
  • vn_type string

Responses

  • 201 application/json

    Created

    Hide response attribute Show response attribute object
    • id integer
  • 400

    The request is not following the convention.

  • 403

    The user is not authorized to create a new word (aka. not admin).

  • 500

    The word is already in the database.

POST /words
curl \
 -X POST http://localhost:5000/words \
 --cookie "fastapiusersauth=$API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"en":"Software Construction","en_type":"n","vn":"Xây dựng phần mềm","vn_type":"danh từ"}'
Request example
{
  "en": "Software Construction",
  "en_type": "n",
  "vn": "Xây dựng phần mềm",
  "vn_type": "danh từ"
}
Response examples (201)
{
  "id": 1337
}

Delete (a) word(s) in the database.

DELETE /words

Delete (a) word(s) in the database manually.

application/json

Body Required

The id of the word(s) to be deleted. The array can be either empty, or contain multiple ids.

array[integer] array[integer]

Responses

  • 200

    OK

  • 400

    The request is not following the convention.

  • 403

    The user is not authorized to delete a word (aka. not admin).

  • 404

    The word id's is not found.

  • 500

    Unknown error.

DELETE /words
curl \
 -X DELETE http://localhost:5000/words \
 --cookie "fastapiusersauth=$API_KEY" \
 -H "Content-Type: application/json" \
 -d '[1337,1338,1339]'
Request example
[
  1337,
  1338,
  1339
]