Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
O2OA_plugin_demo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周田
O2OA_plugin_demo
Commits
325e4c74
Commit
325e4c74
authored
Dec 19, 2023
by
周田
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: 接口描述
parent
52d3a607
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
272 additions
and
0 deletions
+272
-0
README.md
o2oa-api2js/README.md
+272
-0
No files found.
o2oa-api2js/README.md
0 → 100644
View file @
325e4c74
`describe.json`
文件中几个 parameters
键值对描述,以及在传参数时,需要以什么样的形式传入
```
json
{
"name"
:
"captchaLogin"
,
"className"
:
"com.x.organization.assemble.authentication.jaxrs.authentication.ActionCaptchaLogin"
,
"description"
:
"用户登录.credential
\u
003dxxxx,password
\u
003dxxxx,使用图片验证码验证."
,
"type"
:
"POST"
,
"path"
:
"jaxrs/authentication/captcha"
,
"contentType"
:
"application/json"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
false
,
"pathParameters"
:
[],
"formParameters"
:
[],
"queryParameters"
:
[],
"ins"
:
[],
"outs"
:
[]
}
```
下面主要介绍的是 pathParameters, formParameters, queryParameters, ins
这四个键值对在 url 和 请求中的作用
## pathParameters
这个字段是将 url 中带括号的内容替换成相应的值
```
json
{
"name"
:
"oauthLogin"
,
"className"
:
"com.x.organization.assemble.authentication.jaxrs.authentication.ActionOauthLogin"
,
"description"
:
"oauth登录认证"
,
"type"
:
"GET"
,
"path"
:
"jaxrs/authentication/oauth/login/name/{name}/code/{code}/redirecturi/{redirectUri}"
,
"contentType"
:
"application/json"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
false
,
"pathParameters"
:
[
{
"name"
:
"name"
,
"type"
:
"String"
,
"description"
:
"oauthClient名称"
},
{
"name"
:
"code"
,
"type"
:
"String"
,
"description"
:
"code"
},
{
"name"
:
"redirectUri"
,
"type"
:
"String"
,
"description"
:
"redirectUri"
}
]
}
```
**jquery样例**
```
js
$
.
ajax
({
type
:
"GET"
,
dataType
:
"json"
,
url
:
"http://localhost:81/x_organization_assemble_authentication/jaxrs/authentication/oauth/login/name/替换参数0/code/替换参数1/redirecturi/替换参数2"
,
headers
:
{
"x-debugger"
:
true
},
contentType
:
"application/json"
,
xhrFields
:
{
"withCredentials"
:
true
},
crossDomain
:
true
,
}).
always
(
function
(
resultJson
)
{
alert
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
});
```
## formParameters
这个字段是传类型为 multipart/form-data 的参数类型到请求中,而不是 json
```
json
{
"name"
:
"postInfoJira"
,
"className"
:
"com.x.organization.assemble.authentication.jaxrs.oauth.ActionInfo"
,
"description"
:
"POST方法实现oauth认证info方法,适配jira."
,
"type"
:
"POST"
,
"path"
:
"jaxrs/oauth/info/jira"
,
"contentType"
:
"multipart/form-data"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
true
,
"pathParameters"
:
[],
"formParameters"
:
[
{
"name"
:
"access_token"
,
"type"
:
"String"
,
"description"
:
"访问令牌"
}
],
"queryParameters"
:
[],
"ins"
:
[],
"outs"
:
[
{
"name"
:
"text"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"text"
},
{
"name"
:
"contentType"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"返回Content_Type"
}
]
},
```
**jquery样例**
```
js
var
formData
=
new
FormData
();
formData
.
append
(
"access_token"
,
"参数0"
);
$
.
ajax
({
type
:
"POST"
,
url
:
"http://localhost:81/x_organization_assemble_authentication/jaxrs/oauth/info/jira"
,
headers
:
{
"x-debugger"
:
true
},
contentType
:
"multipart/form-data"
,
processData
:
false
,
xhrFields
:
{
"withCredentials"
:
true
},
crossDomain
:
true
,
data
:
formData
,
});
```
## queryParameters
放在 url 后面的变量
```
json
{
"name"
:
"getInfoJira"
,
"className"
:
"com.x.organization.assemble.authentication.jaxrs.oauth.ActionInfo"
,
"description"
:
"GET方法实现oauth认证info方法,适配jira."
,
"type"
:
"GET"
,
"path"
:
"jaxrs/oauth/info/jira"
,
"contentType"
:
"multipart/form-data"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
false
,
"pathParameters"
:
[],
"formParameters"
:
[],
"queryParameters"
:
[
{
"name"
:
"access_token"
,
"type"
:
"String"
,
"description"
:
"access_token"
}
],
"ins"
:
[],
"outs"
:
[
{
"name"
:
"text"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"text"
},
{
"name"
:
"contentType"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"返回Content_Type"
}
]
},
```
**jquery样例**
```
js
var
formData
=
new
FormData
();
$
.
ajax
({
type
:
"GET"
,
url
:
"http://localhost:81/x_organization_assemble_authentication/jaxrs/oauth/info/jira?access_token=替换参数0"
,
headers
:
{
"x-debugger"
:
true
},
contentType
:
"multipart/form-data"
,
processData
:
false
,
xhrFields
:
{
"withCredentials"
:
true
},
crossDomain
:
true
,
data
:
formData
,
});
```
## ins
作为内容传,当时要将 json 内容通过 JSON.stringify 转成字符串传入
```
json
{
"name"
:
"captchaLogin"
,
"className"
:
"com.x.organization.assemble.authentication.jaxrs.authentication.ActionCaptchaLogin"
,
"description"
:
"用户登录.credential
\u
003dxxxx,password
\u
003dxxxx,使用图片验证码验证."
,
"type"
:
"POST"
,
"path"
:
"jaxrs/authentication/captcha"
,
"contentType"
:
"application/json"
,
"resultContentType"
:
"application/json; charset
\u
003dUTF-8"
,
"useJsonElementParameter"
:
false
,
"useStringParameter"
:
false
,
"pathParameters"
:
[],
"formParameters"
:
[],
"queryParameters"
:
[],
"ins"
:
[
{
"name"
:
"credential"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"用户凭证."
,
"isBaseType"
:
true
},
{
"name"
:
"password"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"密码."
,
"isBaseType"
:
true
},
{
"name"
:
"captcha"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"图片认证码编号."
,
"isBaseType"
:
true
},
{
"name"
:
"captchaAnswer"
,
"type"
:
"String"
,
"isCollection"
:
false
,
"description"
:
"图片认证码."
,
"isBaseType"
:
true
}
],
"outs"
:
[]
}
```
**jquery样例**
```
js
var
data
=
{
"credential"
:
"参数"
,
"password"
:
"参数"
,
"captcha"
:
"参数"
,
"captchaAnswer"
:
"参数"
,
};
$
.
ajax
({
type
:
"POST"
,
dataType
:
"json"
,
url
:
"http://localhost:81/x_organization_assemble_authentication/jaxrs/authentication/captcha"
,
headers
:
{
"x-debugger"
:
true
},
contentType
:
"application/json"
,
xhrFields
:
{
"withCredentials"
:
true
},
crossDomain
:
true
,
data
:
JSON
.
stringify
(
data
),
}).
always
(
function
(
resultJson
)
{
alert
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
});
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment