# E速開戶
`python 3.6` `Mlaas 1.0`
This service (XAccount) integrates the APIs of various internal and external systems and outputs uniformly. There are two ways to run it:
- **Mlaas 1.0 mode**: Use in Mlaas 1.0 pipeline.
- **Fastapi mode**: Run it locally with uvicorn.
For convenience, We implemented a mock API service to simulate the external API.
[TOC]
## Usage
If you are building a prodcution service instead of testing, check out *Mlaas user guide*. Otherwise, please follow the steps below:
Install the requirements of XAccount.
```
pip install -r requirements.txt
```
Install the requirements of mock API service.
```
cd mock_server
pip install -r requirements.txt
```
Run the mock API in background.
```
uvicorn main:app --reload --port=8001
```
Once you have run the mock API, there are two ways to run XAccount:
**1. Mlaas 1.0 Mode**
```
python api_service_check_v100.py
```
**2. Fastapi Mode**
```
uvicorn run_api:app --reload --port=8000
```
## API Documentation
#### Main Function
- Domain: `TBD`, `localhost:8000` (for testing)
- URI: `/xaccount`
- Method: `POST`
- Request Body:
```json=
{TBD}
```
- Sample Request:
```json=
{TBD}
```
- Sample Response:
```json=
{TBD}
```
- Status Code:
```
'OK', code=0000
'INTERNAL_ERROR', code=0001
'EXTERNAL_ERROR', code=0002
```
#### Health Check
- Domain: `TBD`, `localhost:8000` (for testing)
- URI: `/health`
- Method: `GET`
- Parameters: `No parameters`
- Sample Response:
```json
{"Hello": "World"}
```
#### Document Hub
- Domain: `localhost:8000`
- URI: `/esundocs`
- Method: `GET`
- Parameters: `No parameters`
To Be Fixed
## Features
- **Repeated Tasks**: Easily connect with different API.
- **No more if-else**: The `AppController` class provides an easily-customized work flow.