MENU navbar-image

Introduction

站点开放 JSON 接口说明(v1)。

本文档描述当前站点提供的 **只读 JSON API**,基础路径为 `/api/v1`。

- 首页已跳转到本页;原 Blade 官网路由仍为 `/product`、`/news` 等。
- 修改或新增接口后,请在项目根目录执行:`php artisan scribe:generate` 以更新文档。
- 亦可下载 Postman 集合:`/docs.postman`,或 OpenAPI:`/docs.openapi`。

<aside>右侧(或移动端内容区)可切换多种语言的请求示例;若需「Try it out」联调,请确保跨域(CORS)已按前端域名配置。</aside>

Authenticating requests

This API is not authenticated.

产品中心

产品增删查改

产品列表

分页返回产品,含分类关联。

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/products?page=1&per_page=15" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/products"
);

const params = {
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "查询产品列表成功",
    "data": [
        {
            "id": 1,
            "title": "测试产品",
            "product_category_id": null,
            "body": "<p><img src=\"http://api.qyz.com/storage/uploads/images/RDBtde3ludzZZKs16staYSIZxkG8SOnVdhSaEw1X.png\" alt=\"图片\" data-href=\"http://api.qyz.com/storage/uploads/images/RDBtde3ludzZZKs16staYSIZxkG8SOnVdhSaEw1X.png\" style=\"\"/>112321312313</p>",
            "cover_photo_path": "uploads/images/N3gcYVGZp0xG1EEItHGqTvZbPYiKVO3nRmI8GITf.png",
            "summary": "测试摘要",
            "author": null,
            "date": null,
            "created_at": "2026-03-21T01:39:56.000000Z",
            "updated_at": "2026-03-21T01:39:56.000000Z"
        }
    ],
    "total": 1,
    "page": 1,
    "per_page": 15,
    "code": 200
}
 

Request      

GET api/v1/products

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

页码 Example: 1

per_page   integer  optional    

每页条数,最大 50 Example: 15

产品详情

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/products/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/products/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "id": 1,
    "title": "测试产品",
    "product_category_id": null,
    "body": "<p><img src=\"http://api.qyz.com/storage/uploads/images/RDBtde3ludzZZKs16staYSIZxkG8SOnVdhSaEw1X.png\" alt=\"图片\" data-href=\"http://api.qyz.com/storage/uploads/images/RDBtde3ludzZZKs16staYSIZxkG8SOnVdhSaEw1X.png\" style=\"\"/>112321312313</p>",
    "cover_photo_path": "uploads/images/N3gcYVGZp0xG1EEItHGqTvZbPYiKVO3nRmI8GITf.png",
    "summary": "测试摘要",
    "author": null,
    "date": null,
    "created_at": "2026-03-21T01:39:56.000000Z",
    "updated_at": "2026-03-21T01:39:56.000000Z",
    "product_category": null
}
 

Request      

GET api/v1/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

产品 ID Example: 1

新增产品

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/products" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"title\": \"智能机器人\",
    \"product_category_id\": 1,
    \"cover_photo_path\": \"\\/images\\/cover.png\",
    \"summary\": \"简介内容\",
    \"body\": \"正文内容\",
    \"author\": \"张三\",
    \"date\": \"2026-03-20\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/products"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "智能机器人",
    "product_category_id": 1,
    "cover_photo_path": "\/images\/cover.png",
    "summary": "简介内容",
    "body": "正文内容",
    "author": "张三",
    "date": "2026-03-20"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/products

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

title   string     

产品标题 Example: 智能机器人

product_category_id   integer  optional    

分类ID Example: 1

cover_photo_path   string  optional    

封面图路径 Example: /images/cover.png

summary   string  optional    

简介 Example: 简介内容

body   string  optional    

正文 Example: 正文内容

author   string  optional    

作者 Example: 张三

date   string  optional    

日期 Example: 2026-03-20

更新产品(POST,body 中带 id,兼容前端)

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/products/update" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": 17,
    \"category_id\": 17
}"
const url = new URL(
    "http://api.qyz.com/api/v1/products/update"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": 17,
    "category_id": 17
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/products/update

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

id   integer     

产品 ID Example: 17

category_id   integer  optional    

分类 ID(与 product_category_id 二选一) Example: 17

PUT api/v1/products/{id}

Example request:
curl --request PUT \
    "http://api.qyz.com/api/v1/products/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"title\": \"vmqeopfuudtdsufvyvddq\",
    \"product_category_id\": 17,
    \"cover_photo_path\": \"mqeopfuudtdsufvyvddqa\",
    \"summary\": \"mniihfqcoynlazghdtqtq\",
    \"body\": \"consequatur\",
    \"author\": \"mqeopfuudtdsufvyvddqa\",
    \"date\": \"mniihfqcoynlazghdtqtq\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/products/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "vmqeopfuudtdsufvyvddq",
    "product_category_id": 17,
    "cover_photo_path": "mqeopfuudtdsufvyvddqa",
    "summary": "mniihfqcoynlazghdtqtq",
    "body": "consequatur",
    "author": "mqeopfuudtdsufvyvddqa",
    "date": "mniihfqcoynlazghdtqtq"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

PUT api/v1/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the product. Example: 1

Body Parameters

title   string     

validation.max. Example: vmqeopfuudtdsufvyvddq

product_category_id   integer  optional    

Example: 17

cover_photo_path   string  optional    

validation.max. Example: mqeopfuudtdsufvyvddqa

summary   string  optional    

validation.max. Example: mniihfqcoynlazghdtqtq

body   string  optional    

Example: consequatur

author   string  optional    

validation.max. Example: mqeopfuudtdsufvyvddqa

date   string  optional    

validation.max. Example: mniihfqcoynlazghdtqtq

删除产品

Example request:
curl --request DELETE \
    "http://api.qyz.com/api/v1/products/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/products/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/products/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

产品 ID Example: 1

产品分类

产品分类增删查改

分类列表

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/product_categories?page=1&per_page=15" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/product_categories"
);

const params = {
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "查询分类列表成功",
    "data": [
        {
            "id": 1,
            "name": "测试logo11",
            "icon": "uploads/images/Wu5JVNHx4HFxBB3DsHEFbNHDhseMBVUmzer9163u.png",
            "created_at": "2026-03-20T08:38:48.000000Z",
            "updated_at": "2026-03-20T08:42:54.000000Z"
        }
    ],
    "total": 1,
    "page": 1,
    "per_page": 15,
    "code": 200
}
 

Request      

GET api/v1/product_categories

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

页码 Example: 1

per_page   integer  optional    

每页条数,最大 50 Example: 15

分类详情

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/product_categories/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/product_categories/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "id": 1,
    "name": "测试logo11",
    "icon": "uploads/images/Wu5JVNHx4HFxBB3DsHEFbNHDhseMBVUmzer9163u.png",
    "created_at": "2026-03-20T08:38:48.000000Z",
    "updated_at": "2026-03-20T08:42:54.000000Z"
}
 

Request      

GET api/v1/product_categories/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

分类 ID Example: 1

新增分类

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/product_categories" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"显示器\",
    \"icon\": \"\\/images\\/icon.png\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/product_categories"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "显示器",
    "icon": "\/images\/icon.png"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/product_categories

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string  optional    

分类名称 Example: 显示器

icon   string  optional    

图标 Example: /images/icon.png

更新分类

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/product_categories/update" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"显示器\",
    \"icon\": \"\\/images\\/icon.png\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/product_categories/update"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "显示器",
    "icon": "\/images\/icon.png"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/product_categories/update

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

分类 ID Example: 1

Body Parameters

name   string  optional    

分类名称 Example: 显示器

icon   string  optional    

图标 Example: /images/icon.png

删除分类

Example request:
curl --request DELETE \
    "http://api.qyz.com/api/v1/product_categories/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/product_categories/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/product_categories/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

分类 ID Example: 1

后台认证

后台管理系统登录接口

后台登录

使用邮箱或账号(name)和密码进行登录校验,成功后返回访问令牌(Bearer Token)和用户信息。

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/admin/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"login\": \"admin\",
    \"email\": \"admin@example.com\",
    \"name\": \"admin\",
    \"password\": \"123456\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/admin/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "login": "admin",
    "email": "admin@example.com",
    "name": "admin",
    "password": "123456"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/admin/login

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

login   string  optional    

登录标识(邮箱或账号) Example: admin

email   string  optional    

兼容字段:登录邮箱 Example: admin@example.com

name   string  optional    

兼容字段:账号(同 login) Example: admin

password   string     

登录密码 Example: 123456

GET api/v1/admin/userlist

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/admin/userlist" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/admin/userlist"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "请求用户信息成功",
    "data": {
        "total": 1,
        "page": 1,
        "per_page": 15,
        "list": [
            {
                "id": 1,
                "name": "admin",
                "email": "admin@example.com"
            }
        ]
    },
    "code": 200
}
 

Request      

GET api/v1/admin/userlist

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

POST api/v1/admin/users

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/admin/users" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"vmqeopfuudtdsufvyvddq\",
    \"email\": \"kunde.eloisa@example.com\",
    \"password\": \"4[*UyPJ\\\"}6\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/admin/users"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "vmqeopfuudtdsufvyvddq",
    "email": "kunde.eloisa@example.com",
    "password": "4[*UyPJ\"}6"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/admin/users

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

validation.max. Example: vmqeopfuudtdsufvyvddq

email   string     

validation.email validation.max. Example: kunde.eloisa@example.com

password   string     

validation.min. Example: 4[*UyPJ"}6

PUT api/v1/admin/users/{id}

Example request:
curl --request PUT \
    "http://api.qyz.com/api/v1/admin/users/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"vmqeopfuudtdsufvyvddq\",
    \"email\": \"kunde.eloisa@example.com\",
    \"password\": \"4[*UyPJ\\\"}6\"
}"
const url = new URL(
    "http://api.qyz.com/api/v1/admin/users/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "vmqeopfuudtdsufvyvddq",
    "email": "kunde.eloisa@example.com",
    "password": "4[*UyPJ\"}6"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

PUT api/v1/admin/users/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the user. Example: 1

Body Parameters

name   string     

validation.max. Example: vmqeopfuudtdsufvyvddq

email   string     

validation.email validation.max. Example: kunde.eloisa@example.com

password   string  optional    

validation.min. Example: 4[*UyPJ"}6

图片上传

上传图片并返回可访问的 URL。

图片上传

使用 multipart/form-data 上传文件。

Example request:
curl --request POST \
    "http://api.qyz.com/api/v1/upload/image" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --form "file=@C:\Users\Administrator\AppData\Local\Temp\php9340.tmp" \
    --form "image=@C:\Users\Administrator\AppData\Local\Temp\php933F.tmp" 
const url = new URL(
    "http://api.qyz.com/api/v1/upload/image"
);

const headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('file', document.querySelector('input[name="file"]').files[0]);
body.append('image', document.querySelector('input[name="image"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());

Request      

POST api/v1/upload/image

Headers

Content-Type        

Example: multipart/form-data

Accept        

Example: application/json

Body Parameters

file   file     

上传文件(图片) Example: C:\Users\Administrator\AppData\Local\Temp\php9340.tmp

image   file  optional    

10MB. Must be a file. validation.image validation.max. Example: C:\Users\Administrator\AppData\Local\Temp\php933F.tmp

新闻资讯

新闻列表与详情(只读)

新闻列表

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/news?page=1&per_page=15" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/news"
);

const params = {
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "current_page": 1,
    "data": [],
    "first_page_url": "http://api.qyz.com/api/v1/news?page=1",
    "from": null,
    "last_page": 1,
    "last_page_url": "http://api.qyz.com/api/v1/news?page=1",
    "links": [
        {
            "url": null,
            "label": "pagination.previous",
            "active": false
        },
        {
            "url": "http://api.qyz.com/api/v1/news?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "pagination.next",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://api.qyz.com/api/v1/news",
    "per_page": 15,
    "prev_page_url": null,
    "to": null,
    "total": 0
}
 

Request      

GET api/v1/news

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

页码 Example: 1

per_page   integer  optional    

每页条数,最大 50 Example: 15

新闻详情

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/news/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/news/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "No query results for model [App\\Models\\News] 1"
}
 

Request      

GET api/v1/news/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

新闻 ID Example: 1

案例

案例列表与详情(只读)

案例列表

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/anlis?page=1&per_page=15" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/anlis"
);

const params = {
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "current_page": 1,
    "data": [],
    "first_page_url": "http://api.qyz.com/api/v1/anlis?page=1",
    "from": null,
    "last_page": 1,
    "last_page_url": "http://api.qyz.com/api/v1/anlis?page=1",
    "links": [
        {
            "url": null,
            "label": "pagination.previous",
            "active": false
        },
        {
            "url": "http://api.qyz.com/api/v1/anlis?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "pagination.next",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://api.qyz.com/api/v1/anlis",
    "per_page": 15,
    "prev_page_url": null,
    "to": null,
    "total": 0
}
 

Request      

GET api/v1/anlis

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

页码 Example: 1

per_page   integer  optional    

每页条数,最大 50 Example: 15

案例详情

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/anlis/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/anlis/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "No query results for model [App\\Models\\Anli] 1"
}
 

Request      

GET api/v1/anlis/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

案例 ID Example: 1

解决方案

方案列表与详情(只读)

方案列表

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/solutions?page=1&per_page=15" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/solutions"
);

const params = {
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "current_page": 1,
    "data": [],
    "first_page_url": "http://api.qyz.com/api/v1/solutions?page=1",
    "from": null,
    "last_page": 1,
    "last_page_url": "http://api.qyz.com/api/v1/solutions?page=1",
    "links": [
        {
            "url": null,
            "label": "pagination.previous",
            "active": false
        },
        {
            "url": "http://api.qyz.com/api/v1/solutions?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "pagination.next",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://api.qyz.com/api/v1/solutions",
    "per_page": 15,
    "prev_page_url": null,
    "to": null,
    "total": 0
}
 

Request      

GET api/v1/solutions

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

page   integer  optional    

页码 Example: 1

per_page   integer  optional    

每页条数,最大 50 Example: 15

方案详情

Example request:
curl --request GET \
    --get "http://api.qyz.com/api/v1/solutions/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://api.qyz.com/api/v1/solutions/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "No query results for model [App\\Models\\Solution] 1"
}
 

Request      

GET api/v1/solutions/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

方案 ID Example: 1