# 注册账号

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/register:
    post:
      summary: 注册账号
      deprecated: false
      description: |+
        注册账号

      tags:
        - 注册和登录
        - AJAX编程/注册和登录
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  title: 用户名
                  description: 中英文和数字组成, 最少8位
                password:
                  type: string
                  title: 密码
                  description: 最少6位
              required:
                - username
                - password
              x-apifox-orders:
                - username
                - password
            example:
              username: 黑马no1hello
              password: '123456'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    title: 业务状态码
                    description: >-
                      10000成功, 10001-无账号/密码, 10002-密码位数不够, 10003-用户名位数不够,
                      10005-用户名被占用
                  message:
                    type: string
                    title: 响应消息
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        title: 用户id
                      account:
                        type: string
                        title: 用户名
                    x-apifox-orders:
                      - id
                      - account
                    title: 响应数据
                    required:
                      - id
                      - account
                required:
                  - code
                  - message
                  - data
                x-apifox-orders:
                  - code
                  - message
                  - data
              examples:
                '1':
                  summary: '成功示例 '
                  value:
                    code: 10000
                    message: 注册成功
                    data:
                      id: 37
                      account: 黑马no1hello
                '2':
                  summary: 账号已存在
                  value:
                    code: 10005
                    message: 账号被占用
                    data: null
          headers: {}
          x-apifox-name: 成功
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    title: 业务状态码
                    description: >-
                      10000成功, 10001-无账号/密码, 10002-密码位数不够, 10003-用户名位数不够,
                      10005-用户名被占用
                  message:
                    type: string
                    title: 响应消息
                  data:
                    type: 'null'
                    title: 响应数据
                required:
                  - code
                  - message
                  - data
                x-apifox-orders:
                  - code
                  - message
                  - data
          headers: {}
          x-apifox-name: 账号已存在
      security: []
      x-apifox-folder: 注册和登录
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/1937884/apis/api-49760218-run
components:
  schemas: {}
  securitySchemes: {}
servers: []
security: []

```
