Document navigation

3rd Party Authentication Operations

CreateIAM2VirtualIDFromLdapUid

API Request

URLs
POST zstack/v1/iam2/virtual-id/ldap/uid
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "ldapUid": "ou\u003dEmployee,uid\u003dtest"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"ldapUid":"ou=Employee,uid=test"}}' http://localhost:8080/zstack/v1/iam2/virtual-id/ldap/uid
Request Parameters
Name Type Location Description Optional Value Starting Version
ldapUid String body (contained in the params structure) The AD/LDAP user UUID. 4.7.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 4.7.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 4.7.0
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "417c94a9fdfb3b61b2e0d11ed42f4b4d",
    "ldapUid": "ou\u003dEmployee,uid\u003dtest",
    "ldapServerUuid": "6e667cc905903cfc82ddef6f14d45831",
    "virtualIDUuid": "bbcf2b14a0d13401872088bd1aa7f930"
  }
}
Name Type Description Starting Version
success boolean 4.7.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventory LdapIAM2VirtualIDRefInventory See inventory. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
ldapUid String The AD/LDAP entry UID. 3.5.1
ldapServerUuid String The AD/LDAP server UUID. 3.5.1
resourceUuid String The UUID of the associated resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
CreateIAM2VirtualIDFromLdapUidAction action = new CreateIAM2VirtualIDFromLdapUidAction();
action.ldapUid = "ou=Employee,uid=test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateIAM2VirtualIDFromLdapUidAction.Result res = action.call();
Python SDK
CreateIAM2VirtualIDFromLdapUidAction action = CreateIAM2VirtualIDFromLdapUidAction()
action.ldapUid = "ou=Employee,uid=test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateIAM2VirtualIDFromLdapUidAction.Result res = action.call()

CreateIAM2VirtualIDLdapBinding

API Request

URLs
POST zstack/v1/iam2/ldap/bindings
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "virtualIDUuid": "7f78522de8ce3e3c8550207c26704dc8",
    "ldapUid": "ou\u003dEmployee,uid\u003dtest"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"virtualIDUuid":"7f78522de8ce3e3c8550207c26704dc8","ldapUid":"ou=Employee,uid=test"}}' http://localhost:8080/zstack/v1/iam2/ldap/bindings
Request Parameters
Name Type Location Description Optional Value Starting Version
virtualIDUuid String body (contained in the params structure) The user UUID. 4.7.0
ldapUid String body (contained in the params structure) The AD/LDAP user UUID. 4.7.0
resourceUuid String body (contained in the params structure) Optional. 4.7.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 4.7.0
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "35f1a7c85cf038f6892a9c6b5e2f0470",
    "ldapUid": "ou\u003dEmployee,uid\u003dtest",
    "ldapServerUuid": "1bca8f5b607b3d0d9cc5b22270c3a262",
    "virtualIDUuid": "5d1be61d0d1d3657afdd9e7829f4d2ed"
  }
}
Name Type Description Starting Version
success boolean 4.7.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventory LdapIAM2VirtualIDRefInventory See inventory. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
ldapUid String The AD/LDAP entry UID. 3.5.1
ldapServerUuid String The AD/LDAP server UUID. 3.5.1
resourceUuid String The UUID of the associated resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
CreateIAM2VirtualIDLdapBindingAction action = new CreateIAM2VirtualIDLdapBindingAction();
action.virtualIDUuid = "52d9727518053f50889bebe14617d2d2";
action.ldapUid = "ou=Employee,uid=test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateIAM2VirtualIDLdapBindingAction.Result res = action.call();
Python SDK
CreateIAM2VirtualIDLdapBindingAction action = CreateIAM2VirtualIDLdapBindingAction()
action.virtualIDUuid = "52d9727518053f50889bebe14617d2d2"
action.ldapUid = "ou=Employee,uid=test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateIAM2VirtualIDLdapBindingAction.Result res = action.call()

GetCandidateLdapEntryForIAM2Binding

API Request

URLs
GET zstack/v1/iam2/ldap/entries/candidates
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/ldap/entries/candidates?ldapFilter=(cn=user_xxx)&limit=2500.0
Request Parameters
Name Type Location Description Optional Value Starting Version
ldapFilter String query The AD/LDAP query filter. 3.5.1
limit Integer query Optional. The limit of AD/LDAP query entries. 3.5.1
systemTags List query Optional. The system tags. 3.5.1
userTags List query Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventories": []
}
Name Type Description Starting Version
inventories List 3.5.1
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1

SDK Sample

Java SDK
GetCandidateLdapEntryForIAM2BindingAction action = new GetCandidateLdapEntryForIAM2BindingAction();
action.ldapFilter = "(cn=user_xxx)";
action.limit = 2500.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateLdapEntryForIAM2BindingAction.Result res = action.call();
Python SDK
GetCandidateLdapEntryForIAM2BindingAction action = GetCandidateLdapEntryForIAM2BindingAction()
action.ldapFilter = "(cn=user_xxx)"
action.limit = 2500.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateLdapEntryForIAM2BindingAction.Result res = action.call()

LoginIAM2VirtualIDWithLdap

API Request

URLs
PUT zstack/v1/iam2/login/virtual-ids/ldap
Body
{
  "loginIAM2VirtualIDWithLdap": {
    "uid": "ou\u003dEmployee,uid\u003dtest",
    "password": "password"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-X PUT -d '{"loginIAM2VirtualIDWithLdap":{"uid":"ou=Employee,uid=test","password":"password"}}' http://localhost:8080/zstack/v1/iam2/login/virtual-ids/ldap
Request Parameters
Name Type Location Description Optional Value Starting Version
uid String body (contained in the loginIAM2VirtualIDWithLdap structure) The login attribute value of the AD/LDAP user. 3.5.1
password String body (contained in the loginIAM2VirtualIDWithLdap structure) The login password of the AD/LDAP user. 3.5.1
verifyCode String body (contained in the loginIAM2VirtualIDWithLdap structure) Optional. The login verification code. 3.5.1
captchaUuid String body (contained in the loginIAM2VirtualIDWithLdap structure) Optional. The UUID of the login authentication code. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "4abb254913c23d488c161bcd3524f176",
    "accountUuid": "ac1453a45c6830c6ad6d488326a4c0ec",
    "expiredDate": "Nov 14, 2017 10:20:57 PM",
    "noSessionEvaluation": false
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventory SessionInventory See inventory. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
accountUuid String The account UUID. 3.5.1
userUuid String The user UUID. 3.5.1
expiredDate Timestamp 3.5.1
createDate Timestamp The creation date. 3.5.1

SDK Sample

Java SDK
LoginIAM2VirtualIDWithLdapAction action = new LoginIAM2VirtualIDWithLdapAction();
action.uid = "ou=Employee,uid=test";
action.password = "password";
LoginIAM2VirtualIDWithLdapAction.Result res = action.call();
Python SDK
LoginIAM2VirtualIDWithLdapAction action = LoginIAM2VirtualIDWithLdapAction()
action.uid = "ou=Employee,uid=test"
action.password = "password"
LoginIAM2VirtualIDWithLdapAction.Result res = action.call()

DeleteIAM2VirtualIDLdapBinding

API Request

URLs
DELETE /v1/iam2/ldap/bindings/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/ldap/bindings/0a7983d3082530c4b6d4b844e694694e?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.1
deleteMode String body Optional. The delete mode. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteIAM2VirtualIDLdapBindingAction action = new DeleteIAM2VirtualIDLdapBindingAction();
action.uuid = "0a7983d3082530c4b6d4b844e694694e";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIAM2VirtualIDLdapBindingAction.Result res = action.call();
Python SDK
DeleteIAM2VirtualIDLdapBindingAction action = DeleteIAM2VirtualIDLdapBindingAction()
action.uuid = "0a7983d3082530c4b6d4b844e694694e"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteIAM2VirtualIDLdapBindingAction.Result res = action.call()

CleanInvalidLdapIAM2Binding

API Request

URLs
PUT zstack/v1/iam2/ldap/bindings/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "cleanInvalidLdapIAM2Binding": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"cleanInvalidLdapIAM2Binding":{}}' http://localhost:8080/zstack/v1/iam2/ldap/bindings/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "642833fc31983380b25ecf08f3f8f8f4",
      "name": "admin",
      "state": "Enabled",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventories List See inventories. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
description String The detailed description of the resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
state State See state. 3.5.1
attributes List See attributes. 3.5.1
#state
Name Type Description Starting Version
name String The resource name. 3.5.1
ordinal int 3.5.1
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
value String 3.5.1
type AttributeType See type. 3.5.1
#type
Name Type Description Starting Version
name String The resource name. 3.5.1
ordinal int 3.5.1

SDK Sample

Java SDK
CleanInvalidLdapIAM2BindingAction action = new CleanInvalidLdapIAM2BindingAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CleanInvalidLdapIAM2BindingAction.Result res = action.call();
Python SDK
CleanInvalidLdapIAM2BindingAction action = CleanInvalidLdapIAM2BindingAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CleanInvalidLdapIAM2BindingAction.Result res = action.call()

QueryIAM2LdapBinding

API Request

URLs
GET zstack/v1/iam2/ldap/bindings
GET zstack/v1/iam2/ldap/bindings/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/ldap/bindings?q=accountUuid=bb452952218931cdb9c058085748dc8a
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/ldap/bindings/c757b80ef90f37dba57f180ac1b52269

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryIAM2LdapBinding, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "5e66b22cb6d33a87802d12b4ee280f64",
      "ldapUid": "ou\u003dEmployee,uid\u003dtest",
      "ldapServerUuid": "03f1ff7e314232ebbb365c7fc62878f3",
      "resourceUuid": "3946f8a48c6d320fbddd0e6c0c30c281"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventories List See inventories. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
ldapUid String The AD/LDAP entry UUID. 3.5.1
ldapServerUuid String The AD/LDAP server UUID. 3.5.1
resourceUuid String The UUID of the associated resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
QueryIAM2LdapBindingAction action = new QueryIAM2LdapBindingAction();
action.conditions = asList("accountUuid=cf0b19d0309c31e2bf9d2f9e50a3a013");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIAM2LdapBindingAction.Result res = action.call();
Python SDK
QueryIAM2LdapBindingAction action = QueryIAM2LdapBindingAction()
action.conditions = ["accountUuid=5f37176baf4b35479f25bf375879c83d"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIAM2LdapBindingAction.Result res = action.call()

SyncLdapServer

API Request

URLs
PUT zstack/v1/ldap/servers/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncLdapServer": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncLdapServer":{}}' http://localhost:8080/zstack/v1/ldap/servers/7a3718959bae3ac88e0b828e06ab2e22/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "14dc461677b23ea1a984849f501a7152"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.5.1
inventory LongJobInventory See inventory. 3.5.1
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
description String The detailed description of the resource. 3.5.1
apiId String The API ID used to associate with the task progress. 3.5.1
jobName String The job name. 3.5.1
jobData String The job data. 3.5.1
jobResult String The job result. 3.5.1
targetResourceUuid String The target resource UUID. 3.5.1
managementNodeUuid String The management node UUID. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
state LongJobState See state. 3.5.1
#state
Name Type Description Starting Version
name String The resource name. 3.5.1
ordinal int 3.5.1

SDK Sample

Java SDK
SyncLdapServerAction action = new SyncLdapServerAction();
action.uuid = "7a3718959bae3ac88e0b828e06ab2e22";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncLdapServerAction.Result res = action.call();
Python SDK
SyncLdapServerAction action = SyncLdapServerAction()
action.uuid = "7a3718959bae3ac88e0b828e06ab2e22"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncLdapServerAction.Result res = action.call()

CreateOAuthClient

API Request

URLs
POST zstack/v1/create/oauth2/client
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test",
    "description": "test",
    "clientId": "756770202fcd36bfbaa00ea7dea7f5ff",
    "clientSecret": "8255b36a4e0e38ffa20dda1a079aa687",
    "authorizationUrl": "http://zstack.com/code",
    "tokenUrl": "http://zstack.com/token",
    "userinfoUrl": "http://zstack.com/userinfoUrl",
    "redirectUrl": "http://zstack.com/redirectUrl",
    "logoutUrl": "http://zstack.com/logoutUrl",
    "loginType": "iam1",
    "urlTemplate": "http://172.24.194.28:5000/oauth1/verify/?username\u003d${username}\u0026sessionId\u003d${sessionId}\u0026userUuid\u003d${userUuid}\u0026accountUuid\u003d${accountUuid}\u0026loginType\u003d${loginType}\u0026userType\u003d${userType}\u0027"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X POST -d '{"params":{"name":"test","description":"test","clientId":"756770202fcd36bfbaa00ea7dea7f5ff","clientSecret":"8255b36a4e0e38ffa20dda1a079aa687",
"authorizationUrl":"http://zstack.com/code",
"tokenUrl":"http://zstack.com/token",
"userinfoUrl":"http://zstack.com/userinfoUrl",
"redirectUrl":"http://zstack.com/redirectUrl",
"logoutUrl":"http://zstack.com/logoutUrl",
"loginType":"iam1","urlTemplate":"http://172.24.194.28:5000/oauth1/verify/?username=${username}&sessionId=${sessionId}&userUuid=${userUuid}&accountUuid=${accountUuid}&loginType=${loginType}&userType=${userType}'"}}'
http://localhost:8080/zstack/v1/create/oauth2/client
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the paramsstructure) The resource name. 4.5.0
description String body (contained in the paramsstructure) Optional. The detailed description of the resource. 4.5.0
clientId String body (contained in the paramsstructure) The client ID. 4.5.0
clientSecret String body (contained in the paramsstructure) Optional. The client key. 4.5.0
authorizationUrl String body (contained in the paramsstructure) Optional. The authentication url. 4.5.0
tokenUrl String body (contained in the paramsstructure) The authentication token url. 4.5.0
loginType String body (contained in the paramsstructure) The login type.
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
clientType String body (contained in the paramsstructure) The client type. 4.5.0
grantType String body (contained in the paramsstructure) The authentication mode. 4.5.0
urlTemplate (可选) String body (contained in the paramsstructure) The address skipped to after the authentication. 4.5.0
resourceUuid String body (contained in the paramsstructure) Optional. The resource UUID. 4.5.0
tagUuids List body (contained in the paramsstructure) Optional. The tag UUID. 4.5.0
systemTags List body Optional. The system tag. 4.5.0
userTags List body Optional. The user tag. 4.5.0
userinfoUrl String body (contained in the paramsstructure) Optional. User information url. 4.7.21
redirectUrl String body (contained in the paramsstructure) Optional. User redirect url. 4.7.21
logoutUrl String body (contained in the paramsstructure) Optional. Logout url. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "clientId": "b7e1d25d8ae833f8b6f13c448efbfb4a",
    "clientSecret": "64a93cc0b9263993a25ef033994afc10",
    "authorizationUrl": "http://zstack.com/code",
    "tokenUrl": "http://zstack.com/token",
    "userinfoUrl": "http://zstack.com/userinfoUrl",
    "uuid": "628dbf582da836ba9693c8813f98371f",
    "loginMNUrl": "http://127.0.0.1:8080/zstack/sso/oauth2/",
    "redirectUrl": "http://zstack.com/redirectUrl"
  }
}
Name Type Description Starting Version
success boolean 4.5.0
inventory OAuth2ClientInventory See inventory. 4.5.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.5.0
#inventory
Name Type Description Starting Version
clientId String The client ID. 4.5.0
clientSecret String The client key. 4.5.0
authorizationUrl String The authentication url. 4.5.0
tokenUrl String The authentication token url. 4.5.0
grantType String The authentication mode. 4.5.0
uuid String The resource UUID. 4.5.0
name String The resource name. 4.5.0
description String The detailed information of the resource. 4.5.0
clientType String The client type. 4.5.0
loginType String The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
.
4.5.0
loginMNUrl String The password-free login url. 4.5.0
createDate Timestamp The creation date. 4.5.0
lastOpDate Timestamp The last operation date. 4.5.0
accountUuid String The account UUID. 4.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.5.0
description String The brief description of the error. 4.5.0
details String The details about the error. 4.5.0
elaboration String The reserved field. Default value: null. 4.5.0
opaque LinkedHashMap The reserved field. Default value: null. 4.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.5.0

SDK Sample

Java SDK
CreateOAuthClientAction action = new CreateOAuthClientAction();
action.name = "test";
action.description = "test";
action.clientId = "756770202fcd36bfbaa00ea7dea7f5ff";
action.clientSecret = "8255b36a4e0e38ffa20dda1a079aa687";
action.authorizationUrl = "http://zstack.com/code";
action.tokenUrl = "http://zstack.com/token";
action.userinfoUrl = "http://zstack.com/userinfoUrl";
action.redirectUrl = "http://zstack.com/redirectUrl";
action.logoutUrl = "http://zstack.com/logoutUrl";
action.loginType = "iam1";
action.urlTemplate = "http://172.24.194.28:5000/oauth1/verify/?username=${username}&sessionId=${sessionId}&userUuid=${userUuid}&accountUuid=${accountUuid}&loginType=${loginType}&userType=${userType}'";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateOAuthClientAction.Result res = action.call();
Python SDK
CreateOAuthClientAction action = CreateOAuthClientAction()
action.name = "test"
action.description = "test"
action.clientId = "756770202fcd36bfbaa00ea7dea7f5ff"
action.clientSecret = "8255b36a4e0e38ffa20dda1a079aa687"
action.authorizationUrl = "http://zstack.com/code"
action.tokenUrl = "http://zstack.com/token"
action.userinfoUrl = "http://zstack.com/userinfoUrl"
action.redirectUrl = "http://zstack.com/redirectUrl"
action.logoutUrl = "http://zstack.com/logoutUrl"
action.loginType = "iam1"
action.urlTemplate = "http://172.24.194.28:5000/oauth1/verify/?username=${username}&sessionId=${sessionId}&userUuid=${userUuid}&accountUuid=${accountUuid}&loginType=${loginType}&userType=${userType}'"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateOAuthClientAction.Result res = action.call()

UpdateOAuthClient

API Request

URLs
POST zstack/v1/update/oauth2/client
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test",
    "description": "test",
    "clientId": "9f44e569b86c3883b0295fcab980e945",
    "clientSecret": "8b151acd0f7533538ed9e9315fadcaca",
    "authorizationUrl": "http://zstack.com/code",
    "tokenUrl": "http://zstack.com/token",
    "redirectUrl": "http://zstack.com/redirectUrl",
    "userinfoUrl": "http://zstack.com/userinfoUrl",
    "loginType": "iam1",
    "logoutUrl": "http://zstack.com/logouturl"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X POST -d '{"params":{"name":"test","description":"test","clientId":"9f44e569b86c3883b0295fcab980e945","clientSecret":"8b151acd0f7533538ed9e9315fadcaca",
"authorizationUrl":"http://zstack.com/code",
"tokenUrl":"http://zstack.com/token",
"redirectUrl":"http://zstack.com/redirectUrl",
"userinfoUrl":"http://zstack.com/userinfoUrl","loginType":"iam1",
"logoutUrl":"http://zstack.com/logouturl"}}'
http://localhost:8080/zstack/v1/update/oauth2/client
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String body (contained in the paramsstructure) The resource UUID. 4.5.0
name String body (contained in the paramsstructure) Optional. The resource name. 4.5.0
description String body (contained in the paramsstructure) Optional. The detailed description of the resource. 4.5.0
clientId String body (contained in the paramsstructure) Optional. The client ID. 4.5.0
clientSecret String body (contained in the paramsstructure) Optional. The client key. 4.5.0
authorizationUrl String body (contained in the paramsstructure) Optional. The authentication url. 4.5.0
tokenUrl String body (contained in the paramsstructure) The authentication token url. 4.5.0
loginType String body (contained in the paramsstructure) The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
systemTags List body Optional. The system tag. 4.5.0
userTags List body Optional. The user tag. 4.5.0
redirectUrl String body (contained in the paramsstructure) Optional. User information url. 4.7.21
userinfoUrl String body (contained in the paramsstructure) Optional. User redirect url. 4.7.21
logoutUrl String body (contained in the paramsstructure) Optional. Logout url. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "clientId": "90de13d7ad483cb582bd14c792bd1ba7",
    "clientSecret": "e9107bd9f6213e29926da80c016a9639",
    "authorizationUrl": "http://zstack.com/code",
    "tokenUrl": "http://zstack.com/token",
    "userinfoUrl": "http://zstack.com/userinfoUrl",
    "uuid": "76467fb551ca362d98d6ba0782f3bb4c",
    "loginMNUrl": "http://127.0.0.1:8080/zstack/sso/oauth2/",
    "redirectUrl": "http://zstack.com/redirectUrl"
  }
}
Name Type Description Starting Version
success boolean 4.5.0
inventory OAuth2ClientInventory See inventory. 4.5.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.5.0
#inventory
Name Type Description Starting Version
clientId String The client ID. 4.5.0
clientSecret String The client key. 4.5.0
authorizationUrl String The authentication url. 4.5.0
tokenUrl String The authentication token url. 4.5.0
grantType String The authentication mode. 4.5.0
uuid String The resource UUID. 4.5.0
name String The resource name. 4.5.0
description String The detailed description of the resource. 4.5.0
clientType String The client type. 4.5.0
loginType String The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
loginMNUrl String The password-free login url. 4.5.0
createDate Timestamp The creation date. 4.5.0
lastOpDate Timestamp The last operation date. 4.5.0
accountUuid String The account UUID. 4.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.5.0
description String The brief description of the error. 4.5.0
details String The details about the error. 4.5.0
elaboration String The reserved field. Default value: null. 4.5.0
opaque LinkedHashMap The reserved field. Default value: null. 4.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.5.0

SDK Sample

Java SDK
UpdateOAuthClientAction action = new UpdateOAuthClientAction();
action.name = "test";
action.description = "test";
action.clientId = "9f44e569b86c3883b0295fcab980e945";
action.clientSecret = "8b151acd0f7533538ed9e9315fadcaca";
action.authorizationUrl = "http://zstack.com/code";
action.tokenUrl = "http://zstack.com/token";
action.redirectUrl = "http://zstack.com/redirectUrl";
action.userinfoUrl = "http://zstack.com/userinfoUrl";
action.loginType = "iam1";
action.logoutUrl = "http://zstack.com/logouturl";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateOAuthClientAction.Result res = action.call();
Python SDK
UpdateOAuthClientAction action = UpdateOAuthClientAction()
action.name = "test"
action.description = "test"
action.clientId = "9f44e569b86c3883b0295fcab980e945"
action.clientSecret = "8b151acd0f7533538ed9e9315fadcaca"
action.authorizationUrl = "http://zstack.com/code"
action.tokenUrl = "http://zstack.com/token"
action.redirectUrl = "http://zstack.com/redirectUrl"
action.userinfoUrl = "http://zstack.com/userinfoUrl"
action.loginType = "iam1"
action.logoutUrl = "http://zstack.com/logouturl"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateOAuthClientAction.Result res = action.call()

GetOAuth2Token

API Request

URLs
GET zstack/v1/get/oauth2/token
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X  GET http://localhost:8080/zstack/v1/get/oauth2/token
Required Parameters
Name Type Location Description Valid Values Starting Version
systemTags List body Optional. The system tags. 4.6.21
userTags List body Optional. The user tags. 4.6.21

API Response

Response Sample
{
  "inventory": {
    "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJGV3NnY2k4cENJQkZFY1hoVkZmNkhzVUkwU1FmekN2SGJ0LVFFOHc4OXJZIn0.eyJleHAiOjE2NjM1NzQ3NjcsImlhdCI6MTY2MzU3NDQ2NywiYXV0aF90aW1lIjoxNjYzNTc0NDY3LCJqdGkiOiI2MzQwOTRjNy00ZjA3LTRlZGMtYjMxMS05MmE5NDc0NWIwYTkiLCJpc3MiOiJodHRwczovLzE3Mi4yMC4xNi4xODg6ODQ0My9hdXRoL3JlYWxtcy9jbG91ZCIsImF1ZCI6ImFjY291bnQiLCJzdWIiOiJkNjYyYWNiYi0yMjYxLTQ2ODctYjNkZS0zOTI2OTA0ZWRlNzQiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJjbG91ZF9zc28iLCJzZXNzaW9uX3N0YXRlIjoiNTM1MjM0ZDUtOTEyYi00NzY2LThhMjktN2Q5MTdkYjE2YTBmIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyIvKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib2ZmbGluZV9hY2Nlc3MiLCJkZWZhdWx0LXJvbGVzLWNsb3VkIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI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5dSIsImdpdmVuX25hbWUiOiJxaXV5dSIsImZhbWlseV9uYW1lIjoiemhhbmciLCJlbWFpbCI6IjI0OTQ0OTcyNkBxcS5jb20ifQ.Mun8NSAnoPW3IjRLFySji8r243ydDYCARMXRstTllM1vsmVp56E3wpfJy8LAf_9PPAo-ryoTkuj1O2Z_nDV4F5lMQ_QASwqIMoBKzg3_Umf-D2pPlTC9BjMIuCeK0qoFiuJq23IS7IN9lYAHDRMdyP6MLUjkyqW-sWgq1l3boT7FcHfkl6cGBzFDLigpsckkm_b7yiN8lDxBdw7SNTcg_AO6D7ZipPG09up8hiatq_4fY1vnhfiBbL9pa8vX4wKoGGR8B_-uO6PrcALOt08QrW06YB084n56dzjD3hCRe9fA9tHB7krTCMnHZN-Bf0QptsYEzwU5zUvIRke9SM88Kg",
    "uuid": "58ac3d5235f230cbbac1bcf966c43685",
    "clientUuid": "b2d39b32cba335888e6c6d9a15c9ce3d",
    "userUuid": "1489d2a1d93531ffb83f2c49cd4cedcd"
  }
}
Name Type Description Starting Version
success boolean 4.6.21
inventory OAuth2TokenInventory See inventory. 4.6.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.6.21
#inventory
Name Type Description Starting Version
accessToken String The access token. 4.6.21
idToken String The id token. 4.6.21
refreshToken String The refresh token. 4.6.21
uuid String The resource UUID. 4.6.21
clientUuid String The client UUID. 4.6.21
userUuid String The user UUID. 4.6.21
createDate Timestamp The creation date. 4.6.21
lastOpDate Timestamp The last operation date. 4.6.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.6.21
description String The brief description of the error. 4.6.21
details String The details about the error. 4.6.21
elaboration String The reserved field. Default value: null. 4.6.21
opaque LinkedHashMap The reserved field. Default value: null. 4.6.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.6.21

SDK Sample

Java SDK
GetOAuth2TokenAction action = new GetOAuth2TokenAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetOAuth2TokenAction.Result res = action.call();
Python SDK
GetOAuth2TokenAction action = GetOAuth2TokenAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetOAuth2TokenAction.Result res = action.call()

CreateCasClient

API Request

URLs
POST zstack/v1/create/cas/client
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test",
    "description": "test",
    "casServerLoginUrl": "http://zstack.com/login",
    "casServerUrlPrefix": "http://zstack.com",
    "serverName": "http://127.0.0.1:8080",
    "loginType": "iam1"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \-X POST -d '{"params":{"name":"test","description":"test","casServerLoginUrl":"http://zstack.com/login","casServerUrlPrefix":"http://zstack.com","serverName":"http://127.0.0.1:8080","loginType":"iam1"}}' \
http://localhost:8080/zstack/v1/create/cas/client
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the paramsstructure) The resource name. 4.5.0
description String body (contained in the paramsstructure) Optional. The detailed description of the resource. 4.5.0
casServerLoginUrl String body (contained in the paramsstructure) casServerLoginUrl. 4.5.0
casServerUrlPrefix String body (contained in the paramsstructure) casServerUrlPrefix. 4.5.0
serverName String body (contained in the paramsstructure) The mn address (http://{mn_ip:port}/8080). 4.5.0
loginType String body (contained in the paramsstructure) The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
urlTemplate (可选) String body (contained in the paramsstructure) Optional. The address skipped to after the password-free login. 4.5.0
resourceUuid String body (contained in the paramsstructure) Optional. The resource UUID. 4.5.0
tagUuids List body (contained in the paramsstructure) Optional. The tag UUID list. 4.5.0
systemTags List body Optional. The system tag. 4.5.0
userTags List body Optional. The user tag. 4.5.0

API Response

Sample Response
{
  "inventory": {
    "casServerUrlPrefix": "http://zstack.com",
    "serverName": "http://127.0.0.1",
    "state": "Enabled",
    "uuid": "6bc5a073efd73d6d861d348694abcc91",
    "loginMNUrl": "http://127.0.0.1:8080/zstack/sso/cas/"
  }
}
Name Type Description Starting Version
success boolean 4.5.0
inventory CasClientInventory See inventory 4.5.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.5.0
#inventory
Name Type Description Starting Version
casServerLoginUrl String casServerLoginUrl. 4.5.0
casServerUrlPrefix String casServerUrlPrefix. 4.5.0
serverName String The mn address (http://{mn_ip:port}/8080). 4.5.0
uuid String The resource UUID. 4.5.0
name String The resource name. 4.5.0
description String The detailed description of the resource. 4.5.0
clientType String clientType. 4.5.0
loginType String The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
loginMNUrl String The password-free login url. 4.5.0
createDate Timestamp The creation date. 4.5.0
lastOpDate Timestamp The last operation date. 4.5.0
accountUuid String The account UUID. 4.5.0
state CasState See state 4.5.0
#state
Name Type Description Starting Version
Enabled CasState 4.5.0
Disabled CasState 4.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.5.0
description String The brief description of the error. 4.5.0
details String The details about the error. 4.5.0
elaboration String The reserved field. Default value: null. 4.5.0
opaque LinkedHashMap The reserved field. Default value: null. 4.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.5.0

SDK Sample

Java SDK
CreateCasClientAction action = new CreateCasClientAction();
action.name = "test";
action.description = "test";
action.casServerLoginUrl = "http://zstack.com/login";
action.casServerUrlPrefix = "http://zstack.com";
action.serverName = "http://127.0.0.1:8080";
action.loginType = "iam1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateCasClientAction.Result res = action.call();
Python SDK
CreateCasClientAction action = CreateCasClientAction()
action.name = "test"
action.description = "test"
action.casServerLoginUrl = "http://zstack.com/login"
action.casServerUrlPrefix = "http://zstack.com"
action.serverName = "http://127.0.0.1:8080"
action.loginType = "iam1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateCasClientAction.Result res = action.call()

UpdateCasClient

API Request

URLs
POST zstack/v1/update/cas/client
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "uuid": "c9b85d8d64353f89a0fc97833dbda36e",
    "description": "test",
    "name": "test",
    "casServerLoginUrl": "http://zstack.com/login",
    "casServerUrlPrefix": "http://zstack.com",
    "serverName": "http://127.0.0.1:8080",
    "loginType": "iam1"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"uuid":"c9b85d8d64353f89a0fc97833dbda36e","description":"test","name":"test","casServerLoginUrl":"http://zstack.com/login","casServerUrlPrefix":"http://zstack.com","serverName":"http://127.0.0.1:8080","loginType":"iam1"}}' \
http://localhost:8080/zstack/v1/update/cas/client
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String body (contained in the paramsstructure) The resource UUID. 4.5.0
description String body (contained in the paramsstructure) Optional. The detailed description of the resource. 4.5.0
name String body (contained in the paramsstructure) Optional. The resource name. 4.5.0
casServerLoginUrl String body (contained in the paramsstructure) Optional. casServerLoginUrl. 4.5.0
casServerUrlPrefix String body (contained in the paramsstructure) Optional. casServerUrlPrefix 4.5.0
serverName String body (contained in the paramsstructure) Optional. The mn address (http://{mn_ip:port}/8080). 4.5.0
loginType String body (contained in the paramsstructure) Optional. The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
systemTags List body Optional. The system tags. 4.5.0
userTags List body Optional. The user tags. 4.5.0

API Response

Sample Response
{
  "inventory": {
    "casServerLoginUrl": "http://zstack.com/login",
    "casServerUrlPrefix": "http://zstack.com",
    "serverName": "http://127.0.0.1:8080/",
    "uuid": "5068f4c641153a3d9353c3326dc1dd5e",
    "name": "test",
    "description": "test",
    "loginType": "iam2",
    "loginMNUrl": "http://127.0.0.1:8080/zstack/sso/cas/"
  }
}
Name Type Description Starting Version
success boolean 4.5.0
inventory CasClientInventory See inventory 4.5.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.5.0
#inventory
Name Type Description Starting Version
casServerLoginUrl String casServerLoginUrl. 4.5.0
casServerUrlPrefix String casServerUrlPrefix. 4.5.0
serverName String The mn address (http://{mn_ip:port}/8080). 4.5.0
uuid String The resource UUID. 4.5.0
name String The resource name. 4.5.0
description String The detailed description of the resource. 4.5.0
clientType String clientType. 4.5.0
loginType String The login type:
  • cas-iam1
  • cas-ima2
  • oauth2-iam1
  • oauth2-iam2
4.5.0
loginMNUrl String The password-free url. 4.5.0
createDate Timestamp The creation date. 4.5.0
lastOpDate Timestamp The last operation date. 4.5.0
accountUuid String The account UUID. 4.5.0
state CasState See state 4.5.0
#state
Name Type Description Starting Version
Enabled CasState 4.5.0
Disabled CasState 4.5.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.5.0
description String The brief description of the error. 4.5.0
details String The details about the error. 4.5.0
elaboration String The reserved field. Default value: null. 4.5.0
opaque LinkedHashMap The reserved field. Default value: null. 4.5.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.5.0

SDK Sample

Java SDK
UpdateCasClientAction action = new UpdateCasClientAction();
action.uuid = "c9b85d8d64353f89a0fc97833dbda36e";
action.description = "test";
action.name = "test";
action.casServerLoginUrl = "http://zstack.com/login";
action.casServerUrlPrefix = "http://zstack.com";
action.serverName = "http://127.0.0.1:8080";
action.loginType = "iam1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCasClientAction.Result res = action.call();
Python SDK
UpdateCasClientAction action = UpdateCasClientAction()
action.uuid = "c9b85d8d64353f89a0fc97833dbda36e"
action.description = "test"
action.name = "test"
action.casServerLoginUrl = "http://zstack.com/login"
action.casServerUrlPrefix = "http://zstack.com"
action.serverName = "http://127.0.0.1:8080"
action.loginType = "iam1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCasClientAction.Result res = action.call()

DeleteSSOClient

API Request

URLs
POST zstack/v1/delete/sso/client
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "uuid": "3e54cb2e27ff31dda2c49851bf2662d2",
    "deleteMode": "Permissive"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"uuid":"3e54cb2e27ff31dda2c49851bf2662d2","deleteMode":"Permissive"}}' \
http://localhost:8080/zstack/v1/delete/sso/client
参数列表
Name Type Location Description Optional Value Starting Version
uuid String body (contained in the paramsstructure) The resource UUID. 4.5.0
deleteMode String body (contained in the paramsstructure) Optional. The deletion mode:
  • Permissive
  • Enforcing,Permissive
4.5.0
systemTags List body Optional. The system tag. 4.5.0
userTags List body Optional. The user tag. 4.5.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteSSOClientAction action = new DeleteSSOClientAction();
action.uuid = "3e54cb2e27ff31dda2c49851bf2662d2";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSSOClientAction.Result res = action.call();
Python SDK
DeleteSSOClientAction action = DeleteSSOClientAction()
action.uuid = "3e54cb2e27ff31dda2c49851bf2662d2"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSSOClientAction.Result res = action.call()

GetSSOClient

API Request

URLs
GET zstack/v1/get/sso/client
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-X  GET http://localhost:8080/zstack/v1/get/sso/client
Required Parameters
Name Type Location Description Valid Values Starting Version
systemTags List body Optional. The system tags. 4.6.21
userTags List body Optional. The user tags. 4.6.21

API Response

Response Sample
{
  "inventories": [
    {
      "uuid": "1fbb7c4cb98d38beb31fa9bd74bff347",
      "name": "test",
      "clientType": "OIDC",
      "loginMNUrl": "http://127.0.0.1:8080/zstack/sso/oauth2/"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.6.21
inventories List See inventories. 4.6.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.6.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.6.21
name String The resource name. 4.6.21
description String The resource description. 4.6.21
clientType String The client type. 4.6.21
loginType String The login type. 4.6.21
loginMNUrl String The url skipped to after the login. 4.6.21
createDate Timestamp The creaion date. 4.6.21
lastOpDate Timestamp The last operation date. 4.6.21
accountUuid String The account UUID. 4.6.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.6.21
description String The brief description of the error. 4.6.21
details String The details about the error. 4.6.21
elaboration String The reserved field. Default value: null. 4.6.21
opaque LinkedHashMap The reserved field. Default value: null. 4.6.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.6.21

SDK Sample

Java SDK
GetSSOClientAction action = new GetSSOClientAction();
GetSSOClientAction.Result res = action.call();
Python SDK
GetSSOClientAction action = GetSSOClientAction()
GetSSOClientAction.Result res = action.call()

UpdateSSORedirectTemplate

API Request

URLs
POST zstack/v1/update/sso/redirectTemplate
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "uuid": "35cc6909f0f23e55a209cd552d8bc938",
    "redirectTemplate": "http://zstack.com/userinfoUrl"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8"
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c"
-X POST -d '{"params":{"uuid":"35cc6909f0f23e55a209cd552d8bc938","redirectTemplate":"http://zstack.com/userinfoUrl"}}'
http://localhost:8080/zstack/v1/update/sso/redirectTemplate
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String body (contained in the params structure) The resource UUID. 4.7.21
redirectTemplate String body (contained in the params structure) The UI redirect address. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Response Sample
{
  "inventory": {
    "uuid": "43679041066d37b28f676a49851ade69",
    "clientUuid": "3e5541e27b9c320fa4ad0a86777cc5ab",
    "redirectTemplate": "http://zstack.com/code"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
inventory OAuth2ClientInventory See inventory. 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
name String The resource name. 4.7.21
description String The detailed description of the resource. 4.7.21
clientUuid String The client uuid. 4.7.21
redirectTemplate String The redirect template. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21

SDK示例

Java SDK
UpdateSSORedirectTemplateAction action = new UpdateSSORedirectTemplateAction();
action.uuid = "35cc6909f0f23e55a209cd552d8bc938";
action.redirectTemplate = "http://zstack.com/userinfoUrl";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSSORedirectTemplateAction.Result res = action.call();
Python SDK
UpdateSSORedirectTemplateAction action = UpdateSSORedirectTemplateAction()
action.uuid = "35cc6909f0f23e55a209cd552d8bc938"
action.redirectTemplate = "http://zstack.com/userinfoUrl"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSSORedirectTemplateAction.Result res = action.call()
API Reference | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center