当前位置:网站首页>nVisual二次开发——第一章 入门介绍
nVisual二次开发——第一章 入门介绍
2022-07-15 09:01:00 【NWVDI耐威迪】
nVisual已被广泛推广,在实际项目进行中遇到了一些接口对接的需求,为了让大家更方便的使用nVisual软件二次开发,小编准备开一个接口介绍专题,方便大家快速上手使用nVisual开放的对外接口进行定制需求的开发和接口对接。

nVisual的对外接口通过token认证权限。如果需要调用nVisual内其他对外接口,第一步就要获取token,在传入的token正确的情况下,接口方能正常处理数据。下面是获取token的对应接口文档:
1. 登录接口
接口描述:传入用户名密码,验证可否登录,获取token
- URL地址:http://ip:port /wapi/v1/authenticate
- 访问方法::POST
- 数据格式:JSON
- 传参
样例数据
{
"username":"*******",
"password":"*******"
}
| 英文参数名 | 中文参数名 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|---|
| username | 用户名 | string | 是 | ||
| password | 密码 | string | 是 |
- 回参
返回成功样例
{
"code": 200,
"data": {
"access_token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJZYW5nRmFuIiwibmFtZSI6IllhbmdGYW4iLCJpYXQiOjE2NTE5MDU3MDN9.9izzwA50yKbRIL-oyhaKFJ1qG_VwIo71tha4fIw5CVdlSURxI05QPxPNGOZ6kMeX3XqCzQcR2Sl5FyVgXdPMpw",
"expires": "2022-05-07T19:41:43.479",
"authority": "Admin",
"token_type": "bearer",
"issued": "2022-05-07T14:41:43.479",
"user": "YangFan",
"userId": 94000000000053,
"expires_in": 17999
}
}
| 英文参数名 | 中文参数名 | 类型 | 描述 |
|---|---|---|---|
| code | 状态码 | Int | 200成功,其他失败,例5005是用户名密码错误 |
| data | 会参数据 | Map | |
| access_token | 令牌 | String | 之后请求接口都需要带着令牌,否则请求不通过 |
| expires | 令牌过期时间 | String | 不用管 |
| authority | 用户权限 | String | 例如Admin为管理员权限,其他具体参照权限表 |
| token_type | 令牌类型 | String | 传入token的时候注意我们是 Bearer Token |
| issued | 令牌创建时间 | String | 不用管 |
| user | 用户名 | String | |
| userId | 用户名id | Long | |
| expires_in | 不用管 |
返回失败样例
{
"code": 5005,
"message": "5005 Bad credentials"
}

在token成功获取后,有半小时过期时间,在使用token请求接口后,token过期时间会刷新,当token过期则需要重新获取,否则其他接口会因token错误而请求失败。token内也会携带用户名和用户权限,有些接口请求失败可能与获取token的用户权限不够有关。
获取到token后,请求其他接口时需要请求头内以Bearer Token方式携带。举在postman调用获取用户信息接口请求为例:

下面附带根据用户id获取用户信息的接口文档:
2. 获取用户信息接口
接口描述:传入用户id获取用户信息
- URL地址:http://ip:port /wapi/v1 /users/{id}/user_id
- 访问方法::GET
- 数据格式:JSON
- 传参
样例请求
release.nvisual.com:8089/wapi/v1/users/94000000000053/user_id
- 回参
返回成功样例
{
"id": 94000000000053,
"username": "*****",
"domain": 12000000000005,
"email": "*****@nwvdi.com",
"password": "",
"lastLogin": "2022-05-07T07:14:57.000+0000",
"lastActivityDate": "2022-05-07T07:15:14.000+0000",
"description": "****",
"comments": "****",
"enabled": true,
"language": 1,
"passwordChanged": false,
"tokenValidFrom": "2022-01-04T06:29:44.687+0000",
"defaultPage": "24000000074693",
"authorities": [
"Admin"
],
"loggedOff": true
}
| 英文参数名 | 中文参数名 | 类型 | 描述 |
|---|---|---|---|
| Id | 用户id | Long | |
| username | 用户名 | string | |
| domain | 分组id | Long | |
| lastLogin | 最后登录时间 | String | |
| lastActivityDate | 最后操作时间 | String | |
| description | 描述 | String | |
| defaultPage | 默认登录页面 | String | 空默认跳转顶页 24000000000001,否则跳到对应页面 |
述文章展示了获取nVisual内token的接口和根据用户id获取用户信息的接口,下一期小编会带大家学习如何使用nVisual的swagger,nVisual的所有对外接口都在swagger页面内介绍使用方式并可测试。

边栏推荐
- Practice and application of Flink flow processing in CSC securities
- An eight year road of Software Testing Engineer
- Flink 在 B 站的多元化探索与实践
- C语言中的关键字struct、union、enum、typedef
- Vs2019 Community Edition Download tutorial (detailed)
- ML:机器学习可解释性之特征置换重要性之机器学习模型中哪些特征很重要?
- CONDA installation package is too slow (take torch as an example)
- Communication between WEMOS and raspberry pie
- conda安装包速度太慢(以torch为例)
- R语言使用循环语句一次性画出多幅图
猜你喜欢

Fast and slow clock domain processing of single bit data pulse broadening method

赛博女娲,怎么造数字人?

Vs2019 Community Edition Download tutorial (detailed)

Proxmox VE 7.2 Install Grafana+Prometheus监控 pve-exporter

基于ycbcr的图像火灾检测系统 基于matkab的GUI系统

Proxmox VE 7.2 qm 方式安装openwet

Evolution and practice of Unicom real-time computing platform

Software testing interface testing practice wechat official account platform postman+newman+jenkins realizes automatic report generation and continuous integration

Proxmox ve 7.2 install SMB service

Proxmox VE 7.2 网卡直通
随机推荐
New development of Flink runtime for streaming batch integration
Solution of MATLAB differential equation
Proxmox ve 7.2 importing virtual machines from CT templates
ML:机器学习可解释性之特征置换重要性之机器学习模型中哪些特征很重要?
Cyber Nuwa, how to make digital people?
zabbix故障集--当你忘记登录zabbix系统的账号密码时
指针与数组笔试题详解
科技公司纷纷反对,英国网络安全法案搁置
Proxmox VE 7.2 ESXi OVA 导入
【C语言】模拟通讯录(数组版、动态版、链表版)
Next generation wireless LAN -- MIMO SDM Foundation
Introduction and Simulation of string function
ZABBIX fault set -- when you forget the account and password to log in to ZABBIX system
bool类型及相关运算符
Comment les entreprises Internet réalisent - elles la pagination, prenez MySQL Strength limit?
Switch and router technology: VLAN trunk, single arm routing, and layer 3 switching and configuration
扎心了!39岁买房后就被裁员了
R language uses circular statements to draw multiple pictures at one time
【无标题】
Technology sharing | quick intercom -5g intercom