Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

These APIs provide services for manipulating ote-stack platform on AI Edge Blueprint. 

API Definitions

User Management

Login

POST /v1/authorization

Description

An access token, which contains user information and expiry time, will be returned by presenting username and password. The client should includes the token in the authorization header of HTTP request to access subsequent request until the token is expired. During the validity period (1 hour), the new token with new expiry time can be obtained through the Update token API with current token.

Parameters

...

Response codes

...

Code

...

Description

...

Successful

...

Unexpected internal errors

...

Example

Code Block
titleExample
collapsetrue
POST /v1/authorization 
Body: 
{ 
	"user": "u1", 
	"password": "xxx" 
} 
Response: 
{ 
	"token": "eyxxxxxxxxxxxxxx", 
	"code": 200, 
	"message": "success" 
} 

Update Token

PUT /v1/authorization

Description

Returns a new authorization token with new expiry time.

Parameters

...

Type

...

Required

...

Default

...

Description

...

Response codes

...

Code

...

Description

...

Successful

...

Unexpected internal errors

...

Example

Code Block
titleExample
collapsetrue
PUT /v1/authorization 
Header: Authorization: eyxxxxxxxxxxxxxx 
Response: { 
	"token": "eyyxxxxxxxxxxxx2", 
	"code": 200, 
	"message": "success" 
} 

Create User

POST /v1/user

Description

Create a user without access token authorization. This user will be available after system administrator approval.

Parameters

...

Name

...

Type

...

Required

...

Default

...

Description

...

Response code

...

Code

...

Description

...

Success

...

Unexpected internal errors

...

Example

Code Block
titleExample
collapsetrue
POST /v1/user 
body: 
{ 
	"user": "u1", 
	"password": "xxX@1234", 
	"phone": "12345678910", 
	"realName": "hello" 
	"isAdmin": true 
} 
Response: 
{ 
	"code": 200, 
	"message": "success" 
}

Update Password

PUT /v1/user

Description

Change the password of the logged-in user

Table of Contents

Introduction

These APIs provide services for manipulating ote-stack platform on AI Edge Blueprint. 

API Definitions

User Management

Login

POST /v1/authorization

Description

An access token, which contains user information and expiry time, will be returned by presenting username and password. The client should includes the token in the authorization header of HTTP request to access subsequent request until the token is expired. During the validity period (1 hour), the new token with new expiry time can be obtained through the Update token API with current token.

Parameters

NameTypeRequiredDefaultDescription
userstringyes
user name
passwordstringyes
user password

Response codes

Code

Description

200

Successful

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
POST /v1/authorization 
Body: 
{ 
	"user": "u1", 
	"password": "xxx" 
} 
Response: 
{ 
	"token": "eyxxxxxxxxxxxxxx", 
	"code": 200, 
	"message": "success" 
} 

Update Token

PUT /v1/authorization

Description

Returns a new authorization token with new expiry time.

Parameters

Name

Type

Required

Default

Description

Authorizationstringyes
token string in Authorization Header

Response codes

Code

Description

200

Successful

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
PUT /v1/authorization 
Header: Authorization: eyxxxxxxxxxxxxxx 
Response: { 
	"token": "eyyxxxxxxxxxxxx2", 
	"code": 200, 
	"message": "success" 
} 

Create User

POST /v1/user

Description

Create a user without access token authorization. This user will be available after system administrator approval.

Parameters

Name

Type

Required

Default

Description

userstringyes
User name
passwordstringyes
Password should be 8-20 characters long with at least 1 uppercase, 1 lowercase and 1 number.
phonestringyes
Phone number
isAdminboolyes
true: general administrator, false: general user
realNamestringyes
Real name

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
POST /v1/user 
body: 
{ 
	"user": "u1", 
	"password": "xxX@1234", 
	"phone": "12345678910", 
	"realName": "hello" 
	"isAdmin": true 
} 
Response: 
{ 
	"code": 200, 
	"message": "success" 
}

Update Password

PUT /v1/user

Description

Change the password of the logged-in user.

Parameters

Name

Type

Required

Default

Description

oldPasswordstringyes
old password
passwordstringyes
new password

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
PUT /v1/user 
body: 
{ 
	"oldPassword": "xxx0", 
	"password": "xxx" 
} 
Response: 
{ 
	"code": 200, 
	"message": "success" 
}

Delete User

DELETE /v1/admin/user/[userid]

Description

This can only be done by general administrator and system administrator. General administrator can delete user in own business namespace while system administrator can delete all users.

Parameters

Name

type

Required

Default

Description

useriduint64yes
User id that needs to be deleted.

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
DELETE /v1/admin/user/1 
Response: 
{ 
	"code": 200, 
	"message": "success" 
}

Reset Password

PUT /v1/admin/user/[userId]/password

Description

This can only be done by general administrator and system administrator. General administrator can update user in own business namespace while system administrator can update all users.

Parameters

Name

Type

Required

Description

userIduint64yesUserId that needs to update. Located in url path.
passwordstringyesNew password that will be updated.Located in body.

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
PUT /v1/admin/user/1/password 
Body: 
{ 
	"password": "xxx" 
} 
Response: 
{
	"code": 200, 
	"message": "success" 
}

Get User List

GET /v1/admin/user

Description

This can only be done by general administrator and system administrator. General administrator can get users in own business namespace while system administrator can get all users.

Parameters

Name

Type

Required

Default

Description

orderBystringno
id
orderBy allows sorting by id and user_name.
orderstringnoascsort order: asc, desc
pageintno1page number
pageSizeintno10page size

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Response Parameters

Name

Type

Description

id
intUser id
user
stringUser name
statusint

Status  

0: Pending

1: Approved

2: Not Approved

3: Forbidden

realNamestringReal name
phonestringPhone number
totalintTotal number of users

createTime

int

Create time of user

updateTime

int

Update time of user

Example

Code Block
titleExample
collapsetrue
GET /v1/admin/user 
Response: 
{ 
	"data": 
	[ 
	{"id":1, "user":"user1", "status":3, "realName":"user1", "phone":"18923441163", "createTime":1551758321, "updateTime":1551758321 }, 
	{"id":2, "user":"user2", "status":3, "realName":"user2", "phone":"18923441123", "createTime":1551758321, "updateTime":1551758321 } 
	],
	"total": 2, 
	"code": 200, 
	"message": "Success" 
}

Audit User

PUT /v1/admin/user/[userId]

Description

This can only be done by system administrator for auditing new user. The new user will be available to create business namespace after system administrator approval.

Parameters

Name

Type

Required

Description

userIduint64yesUserID that needs to be audited.
statusintyes

Status  

0: Pending

1: Approved

2: Not Approved

3: Forbidden


Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
PUT /v1/admin/user/1
body: 
{ 
	"status": 0 
} 
Response: 
{ 
	"code": 200, 
	"message": "success" 
}

Logout

DELETE /v1/authorization

Description

Logout by deleting the access token.

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Example

Code Block
titleExample
collapsetrue
DELETE /v1/authorizations 
Header: Authorization: eyxxxxxxxxxxxxxx 
Response: 
{ 
	"code": 200, 
	"message": "Success" 
} 

Get Authorization Information

GET /v1/authorization

Description

Return the authorization information, such as user name, user role.  

Response parameters

Name

Type

Description

displayName

string

User name

hasRepoAccount

bool

Whether or not the user has created a harbor account

role

int

User role:

0: register user that waiting for approval

1:approved user that do not has business namespace

2:general user

3:business administrator

4:system administrator

privateProject

bool

Flag to indicate if the project is private.

enableIngress

bool

Flag to indicate if the ingress is enabled.

enableAlertboolFlag to indicate if the alert information is enabled.

enableAdminAutoDeploy

bool

Allow deployment that admin submits run automatically without audit.

Example

Code Block
titleExample
collapsetrue
GET /v1/authorization 
Response: 
{ 
	"data": 
	{ 
		"displayName": "ote_test1", 
		"hasRepoAccount": true, 
		"role": 4, 
		"privateProject": true, 
		"enableIngress": false, 
		"enableAlert": true, 
		"enableAdminAutoDeploy": true 
	},
	"code": 200, 
	"message": "Success" 
}

Create Sub-User 

POST /v1/admin/user

Description

Create a user with access token authorization. This user will has the same business namespace with current logged-in administrator. This can only be done by general administrator and system administrator.

Parameters

Name

Type

Required

Default

Description

userstringyes
user name
passwordstringyes
password
phonestringyes
phone number
isAdminboolyes
true: admin false: general user
realNamestringyes
real name

Response code

Code

Description

200

Success

500

Unexpected internal errors

422Parameter validation error

Business Management

Create Business

POST /v1/business

Description

Create a new business namespace. This can only be done by admin who do not create business yet.

Parameters

NameTypeRequiredDefaultDescription
namestringyes
Business name
introducestringyes
Introduction of business
objectivestringyes
purpose for creating business
scalestringyes
the scale of resources excepted to use

Example

Code Block
titleExample
collapsetrue
POST /v1/business
{
"name": "name",
"introduce": "intrduce",
"objective": "objective",
"scale": "scale"
}

Get Business List

GET /v1/business

Description

Return the business list.

parameters

NameTypeRequiredDefaultDescription
pageintno1page
pageSizeintno10page size
orderBystringnoidorderBy allows sorting by id.
orderstringnoascsort order: asc, desc
namestringno
business name filter

Response parameters

NameTypeRequiredDescription
namestringyesbusiness name
userIdintyesuser id
commentstringyesaudit comment
statusint8yes

status

0: pending

1: approved

2: disapproved

3: deleted

Example

Code Block
titleExample
collapsetrue
GET /v1/business
{
	"data": [
	{
   	 	"name": "name",
   	 	"userId": 123,
   	 	"comment": "comment",
   	 	"id": 1,
   	 	"status": 0,
   	 	"createTime": 1590062196,
   	 	"updateTime": 1590062196
	}
  	],
	"total": 1,
	"code":200,
	"message": "Success"
}

Get Business

GET /v1/business/id/[id]

Description

Get the specify business.

Parameters

NameTypeRequiredDescription
namestringyesbusiness name
userIdintyesuse id
introducestringyesIntroduction of business
objectivestringyespurpose for creating business
scalestringyesthe scale of resources excepted to use

Example

Code Block
collapsetrue
GET /v1/business/id/1

{
"data": {
    "name": "name",
    "userId": 123,
    "introduce": "introduce",
    "objective": "",
    "scale": "1400000000",
    "comment": "comment",
    "id": 1,
    "status": 0,
    "createTime": 1590062196,
    "updateTime": 1590062196
  }
"code":200,
"message": "Success"
}

Audit Business

PUT /v1/business/id/[id]

Description

This can only be done by system administrator. A namespace, named "ns+business_id", will be created in all edge clusters. For example, the business id is 123, then the name of namespace is ns123.

Parameters

NameTypeRequiredDescription
idstringyesbusiness id
commentstringyesaudit comment
statusint8yes

comment result:

1: approved; 2: disapproved

Example

Code Block
collapsetrue
PUT /v1/business/id/1

{
    "comment": "pass",
    "status": 1
}

Cluster Management

Get Cluster List

GET /v1/cluster

Description

Get all the cluster list.

Parameters

NameTypeRequiredDefaultDescription
clusterLabel
stringnoallcluster label filter
pageintno1page
pageSizeintnono limitedpage size

Response Parameters

NameTypeDescription
clusterName
stringcluster name
nodeCountintnumber of nodes in the cluster
isReadyboolflag to indicate if the cluster is alive
totalinttotal number of clusters under the filter

Example

Code Block
titleExample
collapsetrue
GET /v1/cluster?clusterLabel=all&page=1&pageSize=10
Response:
{
    "code" : 200,
    "message" : "success",
    "data": [
         { "clusterName": "GuangZhou", "nodeCount": 1, "isReady": false},
         { "clusterName": "BeiJing",   "nodeCount": 2, "isReady": true}
    },
    "total": 2
}

Add Label to Cluster

POST /v1/cluster/label

Description

Label the clusters.

Parameters

NameTypeRequiredDescription
clusterName

[]string

yesthe list of clusters that need to be labeled.
clusterLabel
stringyeslabel name that only use uppercase and lowercase letters, numbers and special character - .

Example

Code Block
title请求示例
collapsetrue
POST /v1/cluster/label
{
    "clusterLabel": "label1",
    "clusterName": ["GuangZhou", "BeiJing"]
}
Response
{
    "code" : 200,
    "message" : "success"
}

Delete Label

DELETE /v1/cluster/label

Description

Delete label of specified clusters.

Parameters

NameTypeRequiredDescription
clusterName

[ ]string

yesthe list of clusters that need to be labeled.
clusterLabel
stringyeslabel name that needs to be removed.

Example

Code Block
collapsetrue
DELETE /v1/cluster/label
{
    "clusterLabel": "label1",
    "clusterName": ["GuangZhou", "BeiJing"]
}
Response
{
    "code" : 200,
    "message" : "success"

}

Get Label List

GET /v1/cluster/label

Description

Get the list of labels that have been created.

Parameters

Response Parameters

NameTypeDescription
data
[]stringthe list of label

Example

Code Block
collapsetrue
GET /v1/cluster/label
Response:
{
    "code" : 200,
    "message" : "success",
    "data": [
         "label1", "label2"
    ]
}

Get Label

GET /v1/cluster/label/[clusterNamel]

Description

Get the labels under the specified cluster.

Parameters

NameTypeRequiredDefaultDescription
clusterNamestringyes
cluster name
pageintno1page
pageSizeintno10page size. 0: no limited

Response Parameters

NametypeDescription
clusterLabel
stringcluster label
createTimeint64create time of label
totalint32total number

Example

Code Block
collapsetrue
GET /v1/cluster/label/cluster1?page=1&pageSize=10
Response:
{
    "code" : 200,
    "message" : "success",
    "data": [
         { "clusterLabel":"GuangZhou", "createTime": 1234567890 },
         { "clusterLabel":"BeiJing", "createTime": 1234567891 }
    ],
    "total": 2
}

Node Management

Get Node List

GET /v1/node

Description

Parameters

NameTypeRequireddefaultDescription

field

string

no


fields that need be presented

nodeLabel

string

no


node label to filter nodes

clusterName

string

no


cluster name for filtering result

nodeName

string

no


node name for filtering result.

page

int

no

1

the page number

pageSize

int

no

10

the size of per page

Response Parameters

NameTyepDescription

nodeName

string

node name

clusterName

string

cluster that node belongs to

operatingSystem

string

os of node

kernelVersion

string

kernel version of node

ip

string

ip address

memory

int64

memory(byte)

cpu

int

cpu core

isReady

bool

flag to indicate if the node is alive.

total

int

total number of nodes

gpu

int

GPU memory(byte)

disk

int64

disk size(byte)

readyNodeCount

int

the number of alive node

Example

Code Block
collapsetrue
GET /v1/node
Response:
{
    "code" : 200,
    "message" : "success",
    "data": [
         {
           "nodeName": "GZ1", 
           "operatingSystem": "Linux", 
           "clusterName": "GuangZhou", 
           "kernelVersion" : "2.6",
           "isReady": true,
           "ip": "1.2.3.4"
         },
         {
           "nodeName": "BJ1", 
           "operatingSystem": "Linux", 
           "clusterName": "BeiJing", 
           "kernelVersion" : "2.6",
           "isReady": true,
           "ip": "1.2.3.4"
         }
    },
    "meta": {
        "readyNodeCount": 2 
    },
    "total": 2
}

Add Label to Node

POST /v1/node/label

Description

Label the nodes.

Parameters

NameTypeRequiredDescription

nodeName

[]string

yes

the list of nodes that need to be labeled.

nodeLabel

string

yes

label name that only use uppercase and lowercase letters, numbers and special character - .

clusterName

string

yes

cluster that nodes belong to.

Example

Code Block
title请求示例
collapsetrue
POST /v1/node/label
{
    "nodeLabel": "label1",
    "clusterName": "c1",
    "nodeName": ["GuangZhou", "BeiJing"]
}
Response:
{
    "code" : 200,
    "message" : "success"
}

Delete Label

DELETE /v1/node/label

Description

Delete label of specified nodes.

Parameters

NameTypeRequiredDefaultDescription
nodeName

[ ]string

yes
the list of nodes that need to remove label.
nodeLabel
stringyes
the label that needs to be removed.
clusterNamestringyes
cluster that nodes belong to.
deleteDeployboolnono

allow to delete deployment on the node that have been labeled.

Example

Code Block
collapsetrue
DELETE /v1/node/label
{
    "nodeLabel": "label1",
    "clusterName": "c1",
    "nodeName": ["GuangZhou", "BeiJing"],
    "deleteDeploy": true
}
Response:
{
    "code" : 200,
    "message" : "success"
}

Get Label List

GET /v1/node/label

Description

Return the list of label of nodes under the specified cluster.

Parameters

NameTypeRequiredDescription

clusterName

string

no

Return node labels in all clusters by default.

Response Parameters

NameTypeDescription

data

[ ]string

the list of label

Example

Code Block
collapsetrue
GET /v1/node/label?clusterName=c1
Response:
{
    "code" : 200,
    "message" : "success",
    "data": ["label1"]
}

Repository Management

Get Images

GET /v1/repository/image

Description

List images of the specified project.

Parameters

Name

Type

Required

Default

Description

orderBy

string

no

id

OrderBy allows sorting by id.

order

string

no

desc

Sort order: asc, desc.

page

int

no

1

The page number.

pageSize

int

no

10

The size of per page, 0 for no limited.

projectNamestringyes
The name of project.
imageNamestringno
Image name for filtering result.

Response code

Code

Description

200

Searched for images of Harbor successfully.

400

Invalid parameters.

401

User need to log in first.

403

User does not have permission of admin role.

500

Unexpected internal errors

Response Parameters

Name

Type

Description

projectName

string

The name of project

public

bool

The flag to indicate the publicity of the image.

imageName

string

The name of image

imageAddress

string

The registry url of image which do not including tag.

createTime

int

The create time of image

updateTime

int

The update time of image

total

int

total number of images

Example

Code Block
collapsetrue
GET /v1/repository/image
Response:
{
    "data": [
        {
            "projectName": "test",
            "public": false,
            "imageName": "test/test-demo1",
            "imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
            "createTime": 1551758321,
            "updateTime": 1551758321
        },
        {
            "projectName": "test2",
            "public": false,
            "imageName": "test2/test-demo2",
            "imageAddress": "registry.dcdn.baidu.com/test2/test-demo2",
            "createTime": 1551758321,
            "updateTime": 1551758321

        }
    ],
    "total": 2,
    "code": 200,
    "message": "success"
}

Get Tag of Image

GET /v1/repository/image/tag?imageName=[imageName]

Description

List tags under the specific image name.

Parameters

Name

Type

Required

Default

Description

page

int

no

1

The page number.

pageSize

int

no

10

The size of per page, 0 for no limited.

imageNamestringyes
The image name for filtering result.

Response code

Code

Description

200

Get tags successfully.

400

Bad request.

401

User need to log in first.

403

User does not have permission of admin role.

500

Unexpected internal errors

Response Parameters

Name

Type

Description

tag

string

tag of docker image

imageAddress

string

repository of docker image

createTime

int

create time

updateTime

int

update time

total

int

total number of images

Example

Code Block
collapsetrue
GET /v1/repository/image/tag?imageName=test/demo1

{
    "data": [
        {
            "tag": "latest",
            "imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
            "createTime": 1551758321,
            "updateTime": 1551758321
        },
        {
            "tag": "v1",
            "imageAddress": "registry.dcdn.baidu.com/test/test-demo1",
            "createTime": 1551758321,
            "updateTime": 1551758321

        }
    ],
    "total": 2,
    "code": 200,
    "message": "success"
}

Delete Image

DELETE /v1/repository/image

Description

Delete multiple images specified by name.

Parameters

Name

Type

Required

Default

Descripton

imageName[ ]stringyes
name of images

Example

Code Block
title请求示例
collapsetrue
DELETE /v1/repository/image
Body: 
{
   "imageName": ["img1", "img2"]
}


Response:
{
    "code": 200,
    "message": "success"
}

Delete Tag of Image

DELETE /v1/repository/image/tag

Description

Delete the image specified by name and tags.

Parameters

Example

...

Name

Type

Required

Default

Description

oldPassword

tag

[ ]stringyes
old passwordpassword

tags of image that needs to be removed
imageNamestringyes
new password

Response code

...

Code

...

Description

...

Success

...

Unexpected internal errors

...


name of image that needs to be removed

Example

Code Block
collapsetrue
PUTDELETE /v1/repository/image/usertag

bodyBody: 
{
 	  "oldPasswordimageName": "xxx0",test/demo1"
   	"passwordtag": ["xxxv1", "v2"]
}


Response:
{
  {  	"code": 200,
 	   "message": "success" 
}

...

Create User

DELETE POST /v1/adminrepository/user/[userid]

Description

This can only be done by general administrator and system administrator. General administrator can delete user in own business namespace while system administrator can delete all users

Description

Create a new user of harbor repository.

Parameters

Name

type

Type

Required

Default

Description

useriduint64yesUser id that needs to be deleted.

Response code

Code

Description

200Success

userstringyes
username
passwordstringyes
password

Response code

Code

Description

200

User created successfully.

400

Unsatisfied with constraints of the user creation.

409username conflict
403

User registration can only be used by admin role user when self-registration is off.

415

The Media Type of the request is not supported, it has to be "application/json"

500

Unexpected internal errors

422Parameter validation error

.

Example

Example
Code Block
title
collapsetrue
DELETEPOST /v1/admin/user/1repository/user
{
"user": "user1",
"password": "xxxx"
}

Response:
{
{    	"code": 200,
 	   "message": "success" 
}

...

Update Password

PUT PUT /v1/adminrepository/user/[userId]/password

DescriptionThis can only be done by general 

administrator and system administrator. General administrator can update user in own business namespace while system administrator can update all usersModify password of current logged-in user.

Parameters

Name

Type

Required

Description

userIduint64yesUserId that needs to update. Located in url path.passwordstringyesNew password that will be updated.Located in body.

Response code

Code

Description

200Success

Required

Default

Description

passwordstringyes
new password

Response code

Code

Description

200

Updated password successfully.

400

Invalid user ID; Old password is blank; New password is blank.

401

Don't have authority to change password. Please check login status.

403

The caller does not have permission to update the password of the user with given ID, or the old password in request body is not correct.

500

Unexpected internal errors.

422Parameter validation error

Example

Example
Code Block
title
collapsetrue
PUT /v1/adminrepository/user/1/password

Body: 
{ 
	"password": "xxxxxxx"

}

Response:
{
  {  	"code": 200,
   	 "message": "success"

}

Get

...

Projects of Repository

GET /v1/adminrepository/user

Description

This can only be done by general administrator and system administrator. General administrator can get users in own business namespace while system administrator can get all usersproject

Description

List all projects of current logged-in user.

Parameters

Name

Type

Required

Default

Description

orderBy
projectNamestringno
id
orderBy allows sorting by id and user_name.orderstringnoascsort order: asc, desc

Project name for filtering results.
publicboolno
Public sign for filtering projects.
pageintno1The page number.
pageSizeintno10The size of per page
size
.

Response code

Code

Description

401

User need to log in first.

200

Success

Return all matched projects.

500

Unexpected internal errors

422Parameter validation error

Internal errors.

Response Parametersparameters

Name

Type

Description

id

projectId

int
User iduser
Project ID.

projectName

string
User
The name
statusint

Status  

0: Pending

1: Approved

2: Not Approved

3: Forbidden

realNamestringReal namephonestringPhone numbertotalintTotal number of users

createTime

int

Create time of user

updateTime

int

Update time of user
of the project

createTime

stringThe creation time of the project.

updateTime

stringThe update time of the project.
publicboolThe public status of the project.
imageCountintThe count of the images under this project.

total

intTotal number of the projects.

Example

Code Block
titleExample
collapsetrue
GET /v1/adminrepository/userproject

Response: 
{ 
	"data": 
	[ 
	{"id":1, "user":"user1", "status":3, "realName":"user1", "phone":"18923441163",Response:
{
"data": [ {
  "projectId": 13,
  "projectName": "calico",
  "createTime": 1551758321,
  "updateTime": 1551758321 },
 	{"id":2, "userimageCount":"user2", "status":3,
  "realNamepublic":"user2", "phone":"18923441123", "createTime":1551758321, "updateTime":1551758321 } 
	 true
  } ],
	"total": 2,

	"code": 200, 
	"message": "Successsuccess"

}

...

Create Project

PUT POST /v1/admin/user/[userId]repository/project

Description

This can only be done by system administrator for auditing new user. The new user will be available to create business namespace after system administrator approvalCreate a new project of the current user.

Parameters

Name

Type

Required

Default

Description

userIduint64yesUserID that needs to be audited.statusintyes

Status  

0: Pending

1: Approved

2: Not Approved

3: Forbidden

Response code

Code

Description

200Success

projectNamestringyes
The name of project.
publicboolyes
The public status of the project.

Response code

Code

Description

201

Project created successfully.

400

Unsatisfied with constraints of the project creation.

401

User need to log in first.

409

Project name already exists.

415

The Media Type of the request is not supported, it has to be "application/json"

500

Unexpected internal errors

422Parameter validation error

.

Example

Example
Code Block
title
collapsetrue
PUTPOST /v1/admin/user/1
body: 
{ 
	"status": 0 repository/project
{
  "projectName": "calico",
  "public": true
}

Response: 
{

	"code": 200,

	"message": "success" 
}

Logout

DELETE /v1/authorization

Description

...

Delete Project

DELETE /v1/repository/project

Description

Delete the projects specified by ID.

Parameters

Name

Type

Required

Default

Description

projectId[ ]int64yes
The IDs of projects

Response code

Code

Description

200Success

201

Project created successfully.

400

Unsatisfied with constraints of the project creation.

401

User need to log in first.

409

Project name already exists.

415

The Media Type of the request is not supported, it has to be "application/json"

500

Unexpected internal errors

422Parameter validation error

.

Example

Example
Code Block
title
collapsetrue
DELETE /v1/authorizationsrepository/project
{
  Header"projectId": Authorization: eyxxxxxxxxxxxxxx[ 1, 2 ]
}

Response: 
{

	"code": 200,

	"message": "Success" 
} 

Get Authorization Information

GET /v1/authorization

Description

Return the authorization information, such as user name, user role.  

Response parameters

...

Type

...

Description

...

displayName

...

string

...

User name

...

hasRepoAccount

...

bool

...

Whether or not the user has created a harbor account

...

role

...

int

...

User role:

0: register user that waiting for approval

1:approved user that do not has business namespace

2:general user

3:business administrator

4:system administrator

...

privateProject

...

bool

...

Flag to indicate if the project is private.

...

enableIngress

...

bool

...

Flag to indicate if the ingress is enabled.

...

enableAdminAutoDeploy

...

bool

...

Allow deployment that admin submits run automatically without audit.

Example

Code Block
titleExample
collapsetrue
GET /v1/authorization 
Response: 
{ 
	"data": 
	{ 
		"displayName": "ote_test1", 
		"hasRepoAccount": true, 
		"role": 4, 
		"privateProject": true, 
		"enableIngress": false, 
		"enableAlert": true, 
		"enableAdminAutoDeploy": true 
	},success"
}

Create External Repository

POST /v1/repository/third

Description

Create a secret registry record for pulling docker images from external repository.

Parameters

NameTypeRequiredDescription

repositoryId

string

yes

A unique name for specifying repository.

address

string

yes

The address of repository.

userstringyesusername for pulling images.
passwordstringyespassword for pulling images.

Example

Code Block
collapsetrue
POST /v1/repository
Body:
{
    "repositoryId": "repo1",
    "address": "127.0.0.1",
    "user": "user1",
    "password": "password1"
}


Response:
{
"code": 200,
"message": "success"
}

Delete External Repository

DELETE /v1/repository/third

Description

Delete the external repository record by ID. It won't affect existing deployment.

Parameters

NameTypeRequiredDescription

repositoryId

[ ]string

yesThe ID of repository

Example

Code Block
collapsetrue
DELETE /v1/repository
Body:
{
    "repositoryId": ["repo1", "repo2"]
}
Response:
{
	"code": 200,

	"message": "Successsuccess"

}

Create Sub-User 

...

Get External Repository List

GET /v1/adminrepository/userthird

Description

Create a user with access token authorization. This user will has the same business namespace with current logged-in administrator. This can only be done by general administrator and system administrator.List the external repository.

Parameters

NameTypeRequiredDefaultDescription
userstringyesuser namepasswordstringyespasswordphonestringyesphone numberisAdminboolyestrue: admin false: general userrealNamestringyesreal name

Response code

...

Code

...

Description

...

Success

...

Unexpected internal errors

...

Business Management

Create Business

POST /v1/business

Description

Create a new business namespace. This can only be done by admin who do not create business yet.

Parameters

...

Example

Code Block
titleExample
collapsetrue
POST /v1/business
{
"name": "name",
"introduce": "intrduce",
"objective": "objective",
"scale": "scale"
}

Get Business List

GET /v1/business

Description

Return the business list.

parameters

...

Response parameters

...

status

0: pending

1: approved

2: disapproved

3: deleted

Example

...

titleExample
collapsetrue

...

pageSizeintno10

The size of per page, 0 for no limited.

pageintno1The page number.
orderBystringnoidorderBy allows sorting by id.
orderstringnoascsort order: asc, desc.

Response Parameters

NameTypeDescription

repositoryId

string

The unique name for specifying repository.

address

string

The address of repository.

userstringusername for pulling images.

Example

Code Block
collapsetrue
GET /v1/repository/third?pageSize=0
response:
{
    "data": [ {
                "id": 1,
                "repositoryId":"yq01",
                "address":"xxzxsdsdsds",
                "user":"ddddddd"
    }, {
                "id": 2,
                "repositoryId":"yq02",
                "address":"xxzxsdsdsds",
                "user":"ddddddd"
    } ],
    "code": 200,
    "total": 2,
    "message": "Success"
}

Get

...

External Repository  

GET GET /v1/businessrepository/idthird/[id]

Description

Get the specify business.

ParametersrepoId]

Description

Return the external repository by ID.

Parameters

Name

Type

Required

Default

Description

repoIdstringyes
The unique name of repository

Response code

状态码

说明

200

Get repository successfully.

404Not found
500

Unexpected internal errors

Response parameters

NameType
Required
Description
namescalestringyesthe scale of resources excepted to use

repositoryId

string

yesbusiness nameuserIdintyesuse idintroducestringyesIntroduction of businessobjectivestringyespurpose for creating business

The unique name for specifying repository.

address

string

The address of repository.

userstringusername for pulling images.

Example

Code Block
collapsetrue
GET /v1/businessrepository/id/1third/repo1
Response:
{
   { "data": {
    "name": "name",     "userId": 123,     "introducerepositoryId": "introduceyq01",
    "objective": "",     "scale": "1400000000",     "commentaddress": "commentxxzxsdsdsds",
    "id": 1,     "status": 0,     "createTimeuser":"ddddddd"
1590062196,    },
"updateTime": 1590062196   }
"code": 200,
    "message": "Success"
}

Application Management