Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
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
ops
jumpserver
Commits
a9b5762f
Commit
a9b5762f
authored
8 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify api style guide info
parent
acd98365
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
api_style_guide.md
docs/api_style_guide.md
+10
-9
project_structure.md
docs/project_structure.md
+1
-0
No files found.
docs/api_style_guide.md
View file @
a9b5762f
...
@@ -21,14 +21,15 @@ https://example.org/api/
...
@@ -21,14 +21,15 @@ https://example.org/api/
### 版本
### 版本
将API的版本号放入URL
将API的版本号放入URL中, 由于一个项目多个app所以Jumpserver使用以下风格,
将版本号放到app后面
```
```
https://example.com/api/v1/
https://example.com/api/:app:/:version:/:resource:
https://example.com/api/assets/v1.0/assets [GET, POST]
https://example.com/api/assets/v1.0/assets/1 [GET, PUT, DELETE]
```
```
另一种做法是,将版本号放在HTTP头信息中,但不如放入URL方便和直观。Github采用这种做法。
### 路径
### 路径
...
@@ -37,11 +38,11 @@ https://example.com/api/v1/
...
@@ -37,11 +38,11 @@ https://example.com/api/v1/
举例来说 cmdb中的assets列表, idc列表
举例来说 cmdb中的assets列表, idc列表
```
```
https://example.com/api/
v1/assets
https://example.com/api/
:app:/:version:/:resource:
https://example.com/api/v1/assetgroups
https://example.com/api/
v1/assetgroups/:id/assets
https://example.com/api/
assets/v1.0/assets [GET, POST]
https://example.com/api/
v1/assets/:id
https://example.com/api/
assets/v1.0/assets/1 [GET, PUT, DELETE]
https://example.com/api/
v1/idcs
https://example.com/api/
assets/v1.0/idcs [GET, POST]
```
```
一般性的增删查改(CRUD)API,完全使用HTTP method加上url提供的语义,url中的可变部分(比如上面提到的
<role
_id
>
)
一般性的增删查改(CRUD)API,完全使用HTTP method加上url提供的语义,url中的可变部分(比如上面提到的
<role
_id
>
)
...
...
This diff is collapsed.
Click to expand it.
docs/project_structure.md
View file @
a9b5762f
...
@@ -45,5 +45,6 @@
...
@@ -45,5 +45,6 @@
│ │ └── wsgi.py
│ │ └── wsgi.py
│ ├── manage.py
│ ├── manage.py
│ ├── static // 项目静态资源目录
│ ├── static // 项目静态资源目录
│ ├── static // 项目多语言目录
│ └── templates // 项目模板目录
│ └── templates // 项目模板目录
```
```
This diff is collapsed.
Click to expand it.
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