Getting Started

说明

1. Endpoint:http://fakerapi.qiji.tech
2. common header
  - version-code:版本号
  - version-name:版本名称
  - device:设备唯一编号
  - channel:渠道号
  - platform:平台类型「android、iOS」
  - Authorization: Bearer {yourtokenhere}「登录用户token传到header里面」
  - Accept: application/vnd.lureapp.v1+json
3. code
  - 200:代表成功返回数据
4. status_code
  - 404:代表没有找到对应的 API 或者 Entity
  - 422:代表没有条件校验不通过
  - 403:用户名或密码不正确
  - 401:未登录

Response数据结构

1. {

}

2. [

]

3. {
    "message": "422 Unprocessable Entity",
    "errors": {
        "category_id": [
            "The category id field is required."
        ]
    },
    "status_code": 422
}

4. {
    "message": "404 Not Found",
    "status_code": 404
}

5. {
    "message": "The version given was unknown or has no registered routes.",
    "status_code": 400
}

6. {
    "message": "用户名或密码不正确",
    "status_code": 403
}

7. {
    "message": "Failed to authenticate because of bad credentials or an invalid authorization header.",
    "status_code": 401
}

Auth

第三方登录

  {
    "id": 22,
    "mobile": "186****4602",
    "email": null,
    "user_info": {
        "user_id": 22,
        "nickname": "MMfdsakf",
        "avatar": "",
        "gender": 0,
        "year_of_birth": 0,
        "month_of_birth": 0,
        "day_of_birth": 0,
        "count_report": 0,
        "count_read": 0,
        "count_post": 10
    },
    "user_token": [
        {
            "open_id": "fdsakf",
            "platform": "qq",
            "is_bind": true
        }
    ],
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vZmFrZXJhcGkucWlqaXRlY2guYXBwL2F1dGgvdGhpcmRfcGFydHkiLCJpYXQiOjE0Njg4MTM2MTYsImV4cCI6MTQ2ODgxNzIxNiwibmJmIjoxNDY4ODEzNjE2LCJqdGkiOiIxMDJjZWM0ZGVkZGMyOGMzZGU5ZTA4MjU0Y2IzZTdmOSIsInN1YiI6MjJ9.gmG0nJ8q3eqejbUQjww7hAjRilrE04ZR0iCNaQ-F2O4"
  }

  • Error
  {
    "message": "422 Unprocessable Entity",
    "errors": {
        "open_id": [
            "The open id field is required."
        ]
    },
    "status_code": 422
  }

Post

动态列表

  • 地址: GET /posts
  • Demo:http://fakerapi.qiji.tech/posts
  • 参数:

    • lng:经度
    • lat:纬度
    • max-id:loadmore使用
    • since-id:refresh使用
    • page_size:每页显示条数,默认20条「optional」
    max-id和since-id不同时使用
    
  • Response

    [
    {
        "id": 110,
        "content": "qqsss",
        "created_at": 1468774879,
        "count_images": 2,
        "lng": 30,
        "lat": 30,
        "images": [
            {
                "id": 213,
                "url": "sss"
            },
            {
                "id": 214,
                "url": "1111"
            }
        ],
        "userInfo": {
            "user_id": 22,
            "nickname": "MMfdsakf",
            "avatar": "",
            "gender": 0
        },
        "category": {
            "id": 1,
            "name": "心情状态"
        }
    },
    {
        "id": 109,
        "content": "qqsss",
        "created_at": 1468570355,
        "count_images": 2,
        "lng": 30,
        "lat": 30,
        "images": [
            {
                "id": 211,
                "url": "sss"
            },
            {
                "id": 212,
                "url": "1111"
            }
        ],
        "userInfo": {
            "user_id": 22,
            "nickname": "MMfdsakf",
            "avatar": "",
            "gender": 0
        },
        "category": {
            "id": 1,
            "name": "心情状态"
        }
    }
    ]
    
    
  • Error

{
    "message": "422 Unprocessable Entity",
    "errors": {
        "lng": [
            "The lng field is required."
        ],
        "lat": [
            "The lat field is required."
        ]
    },
    "status_code": 422
}

发布帖子

  • 地址: POST /posts
  • Demo:http://fakerapi.qiji.tech/posts
  • 参数:

    • post_category_id:类别id
    • lng:经度
    • lat:纬度
    • content:内容(optional)
    • images:图片路径(optional、数组)
    images和content不能同时为空
    
  • Response

    {
    "id": 111,
    "content": "fffff",
    "created_at": 1468818893,
    "count_images": 1,
    "lng": 10,
    "lat": 30,
    "images": [
        {
            "id": 215,
            "url": "1111"
        }
    ],
    "userInfo": {
        "user_id": 22,
        "nickname": "MMfdsakf",
        "avatar": "",
        "gender": 0
    },
    "category": {
        "id": 1,
        "name": "心情状态"
    }
    }
    
  • Error

{
    "message": "422 Unprocessable Entity",
    "errors": {
        "post_category_id": [
            "The post category id field is required."
        ],
        "lng": [
            "The lng field is required."
        ]
    },
    "status_code": 422
}