企业REST API概述
所有API调用都需要提交API令牌。根据您所进行的API调用的类型,身份验证令牌将会发生变化。
例如,如果您正在自动部署扫描引擎,以便在随需应变的场景中扫描web应用程序,以适应高度变化的环境。您将需要以下API令牌。
- 系统管理员—所有扫描引擎动作都需要一个系统管理员令牌。
- 客户账户-所有扫描配置和启动扫描将需要使用客户端帐户的令牌。
基础url
http:// {servername} / AppSpiderEnterprise / rest / v1 /https:// {servername} / AppSpiderEnterprise / rest / v1 /
身份验证
在使用AppSpider Enterprise API之前,您需要首先将令牌添加到授权头。
- 向登录端点发出POST请求
http:// {servername} / AppSpiderEnterprise / rest / v1 /验证/登录去拿你的代币。 - 使用响应
令牌在请求头中作为基本授权令牌。- 例如,
授权:基本ABC0123
- 例如,
AppSpider身份验证
帖子
/ AppSpiderEnterprise /休息/ v1 /验证/登录
描述返回AppSpider授权令牌。
请求体
json
1
{
2
“名称”:“字符串”,
3.
“密码”:“字符串”
4
}
示例请求
bash
1
旋度——请求后\
2
——url http:///%7Bservername%7D/AppSpiderEnterprise/rest/v1/Authentication/Login\
3.
——头“application / json内容类型:\
4
——数据{“名称”:“字符串”,“密码”:“字符串”}”
ruby
1
需要“uri”
2
需要“net/http”
3.
4
url=URI(“http:///%7Bservername%7D/AppSpiderEnterprise/rest/v1/Authentication/Login”)
5
6
http=净::HTTP.新(url.宿主,url.港口)
7
8
请求=净::HTTP::帖子.新(url)
9
请求[“内容类型”]=“application / json”
10
请求.身体=“{\“\”:\“\”,\“密码\”,\“\”}”
11
12
响应=http.请求(请求)
13
将响应.read_body
python
1
进口http.客户端
2
3.
康涅狄格州=http.客户端.HTTPConnection(“insertConsole”)
4
5
有效载荷=“{\ n \“\”:\“insertUsername \”、\ n \ \“密码”:\“insertPassword \ \ n}”
6
7
头={
8
“内容类型”:“application / json”,
9
“cache - control”:“no - cache”
10
}
11
12
康涅狄格州.请求(“职位”,“/ AppSpiderEnterprise /休息/ v1 /验证/登录”,有效载荷,头)
13
14
res=康涅狄格州.getresponse()
15
数据=res.读()
16
17
打印(数据.解码(“utf - 8”))
响应
200年好
json
1
{
2
“令牌”:"",
3.
“IsSuccess”:真正的,
4
“原因”:零,
5
“ErrorMessage”:零
6
}
400 -错误请求
json
1
{
2
“令牌”:零,
3.
“IsSuccess”:假,
4
“原因”:“InvalidCredentials”,
5
“ErrorMessage”:"用户名或密码无效。"
6
}
| 的名字 | 定义 |
|---|---|
| IsSuccess | 包含一个布尔值,如果方法正确执行,则为true。 |
| 原因 | 发生错误的文本。 |
| ErrorMessage | 关于错误的附加信息。 |
这个页面对你有帮助吗?