Проектирование и реализация REST-API информационной системы районной поликлиники. Учет льготных лекарств
Минимум 5 ендпойнтов (CRUD):
1 на создание конкретного ресурса - post
2 на чтение (чтение конкретного и всех) - get
1 на обновление конкретного ресурса - put
1 на удаление конкретного ресурса - delete
На выходе: swagger-файл, код (ссылка на гит или архив)
https://swagger.io/specification/
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
This Python package is automatically generated by the Swagger Codegen project:
- API version: 0.0.3
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen
Python 2.7 and 3.4+
If the python package is hosted on Github, you can install directly from Github
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import swagger_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import swagger_client
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
body = swagger_client.Drug() # Drug |
try:
# Метод добавления нового льготного лекарства в каталог
api_response = api_instance.createdrug(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DrugApi->createdrug: %s\n" % e)
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Идентификатор льготного лекарства
try:
# Метод удаления льготного лекарства по идентификатору
api_instance.deletedrug_by_id(id)
except ApiException as e:
print("Exception when calling DrugApi->deletedrug_by_id: %s\n" % e)
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | Идентификатор льготного лекарства
try:
# Метод получения льготного лекарства по идентификатору
api_response = api_instance.getdrug_by_id(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DrugApi->getdrug_by_id: %s\n" % e)
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
expiration = 'expiration_example' # str | Срок годности льготного лекарства
try:
# Метод получения льготных лекарств по сроку годности
api_response = api_instance.getdrug_byexpiration(expiration)
pprint(api_response)
except ApiException as e:
print("Exception when calling DrugApi->getdrug_byexpiration: %s\n" % e)
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
try:
# Метод получения льготных лекарств
api_response = api_instance.getdrugs()
pprint(api_response)
except ApiException as e:
print("Exception when calling DrugApi->getdrugs: %s\n" % e)
# create an instance of the API class
api_instance = swagger_client.DrugApi(swagger_client.ApiClient(configuration))
body = swagger_client.Drug() # Drug |
id = 'id_example' # str | Идентификатор льготного лекарства
try:
# Метод обновления льготного лекарства в каталоге
api_response = api_instance.updatedrug(body, id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DrugApi->updatedrug: %s\n" % e)
All URIs are relative to http://localhost:1234/api
Class | Method | HTTP request | Description |
---|---|---|---|
DrugApi | createdrug | POST /drugs | Метод добавления нового льготного лекарства в каталог |
DrugApi | deletedrug_by_id | DELETE /drugs/{id} | Метод удаления льготного лекарства по идентификатору |
DrugApi | getdrug_by_id | GET /drugs/{id} | Метод получения льготного лекарства по идентификатору |
DrugApi | getdrug_byexpiration | GET /drugs/expiration/{expiration} | Метод получения льготных лекарств по сроку годности |
DrugApi | getdrugs | GET /drugs | Метод получения льготных лекарств |
DrugApi | updatedrug | PUT /drugs/{id} | Метод обновления льготного лекарства в каталоге |
All endpoints do not require authorization.