简体中文
Fx.erpdss
约 282 字小于 1 分钟
2026-01-09
1. 通过集成平台访问外部接口
Fx.erpdss.proxyRequest(<String url>, <String method>, <Map headers>, <String body>, <String contentType>, <Boolean requestBodyNeedBase64Decode>, <Boolean responseBodyNeedBase64Encode>)
参数说明
入参格式
| 参数名称 | object | 描述 | 是否必填 |
|---|---|---|---|
| url | String | 访问的目标url,如果有,需要带上requestParam | 是 |
| method | String | 请求方法 | 是 |
| headers | Map | 请求的header,Map<String, List<String>> | 是 |
| body | String | 请求的body,可为空 | -- |
| contentType | String | 请求的content类型,默认为application/json | -- |
| requestBodyNeedBase64Decode | Boolean | 请求的body是否需要使用base64解码为byte[] | -- |
| responseBodyNeedBase64Encode | Boolean | 返回值的body是否需要使用base64编码为string | -- |
出参格式
| 参数名称 | object | 描述 |
|---|---|---|
| headers | Map | 请求的header,Map<String, List<String>> |
| code | Integer | 状态码 |
| message | String | 状态信息 |
| body | String | 数据体 |
出参样例
{
"headers": {
"date": [
"Thu, 31 Oct 2024 09:31:47 GMT"
]
},
"code": 200,
"message": "",
"body": "{\"id\":4559,\"uuid\":\"3f97cf57-6abd-46eb-a501-fc7f49aa2ab0\",\"hitokoto\":\"我们是学生,学生就要有学生的样子。\",\"type\":\"b\",\"from\":\"JOJO的奇妙冒险\",\"from_who\":null,\"creator\":\"你家炸了\",\"creator_uid\":3557,\"reviewer\":0,\"commit_from\":\"web\",\"created_at\":\"1564109075\",\"length\":17}"
}Groovy 举例
def (boolean error, Map data, String message) = Fx.biz.callAPI("Fx.erpdss.proxyRequest",
"https://www.google.com", "GET", [:], null
)
if (error) {
log.info("error: " + message)
} else {
log.info(data)
}负责人:谢嘉裕Ken
