# Request

## 1.Interface address=>HTTP

```
http://ip:port/path/
```

DEMO如下：

```http
POST http://127.0.0.1:9008/login/{bizType} # login
POST http://127.0.0.1:9008/register/{bizType} # register
POST http://127.0.0.1:9008/logout # logout
POST http://127.0.0.1:9008/global/{bizType} # other request
...
```

Request method: POST

### 1.2 Request

```
Request header information
Request body information, transmitted in the form of content-type=application/json
```

#### 1.2.1 Header Request Parameters

| parameter | type   | required     | describe                                     |
| --------- | ------ | ------------ | -------------------------------------------- |
| companyId | long   | Required     | System unique company identifier             |
| trace     | String | Required     | Global link unique identifier                |
| timestamp | long   | Required     | Timestamp, milliseconds                      |
| version   | String | Not required | Interface version number                     |
| group     | String | Not required | Interface Grouping                           |
| lang      | String | Not required | Language information, default is zh-CN       |
| token     | String | Not required | Token information, required after logging in |

#### 1.2.2 Request Body Parameters

| parameter | type | required | describe                  |
| --------- | ---- | -------- | ------------------------- |
| bizBody   | JSON | Required | Request message body，JSON |

## 1.2 Interface address=>websocket

```
ws://ip:port/path/ws
```

The DEMO is as follows:

```
ws://127.0.0.1:9008/ws
```

Pass in parameters:

| parameter | type | required | describe             |
| --------- | ---- | -------- | -------------------- |
| header    | JSON | Required | Consistent with http |
| body      | JSON | Required | Consistent with http |

The DEMO is as follows:

```
{
  "header": {
    "trace": "trace",
	"token": "token",
    "bizType": "customer.CustomerWebApiService.login",
    "version": "0.0.1",
	"group": "",
    "companyId": 11,
	"timestamp": 11111131331,
	"lang":"zh-CN"
  },
  "body": {
    "type": 3,
    "loginName": "139"
  }
}
```

The heartbeat format is as follows: bizType is fixed to ping

```
{
  "header": {
    "trace": "trace",
	"token": "token",
    "bizType": "ping",
	"sendTime":1617246557505,
	"lang":"zh-CN"，
	"timestamp": 11111131331
  }
}
```

The format of the heartbeat return message body is as follows: bizType is fixed to pong

```
{
  "trace": "Original parameters returned",
  "token": "Original parameters returned",
  "bizType": "pong",
  "sendTime": 1617678792458,
  "lang": "zh-CN"
}
```

Return parameter:

| parameter |   | type   | describe                                                                                             |
| --------- | - | ------ | ---------------------------------------------------------------------------------------------------- |
| code      |   | String | System general return code. 0-success, other exceptions                                              |
| msg       |   | String | returned messages                                                                                    |
| bizCode   |   | String | Module identification code                                                                           |
| tm        |   | Long   | Processing time (milliseconds)                                                                       |
| trace     |   | String | Global link flag information                                                                         |
| msgParams |   | String | Returns the placeholder parameter string in the description. Multiple parameters are separated by ,  |
| data      |   | Object | Data body, unified return of each business response information, return bizType in case of exception |
