AddLdapServer

API Request

URLs
POST zstack/v1/ldap/servers
Headers
Authorization: OAuth the-session-uuid
Body
{ "params": { "name": "miao", "description": "miao desc", "url": "ldap://localhost:1888", "base": "dc\u003dexample,dc\u003dcom", "username": "", "password": "", "encryption": "None"   }, "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":"miao","description":"miao desc","url":"ldap://localhost:1888","base":"dc=example,dc=com","username":"","password":"","encryption":"None"}}' \ http://localhost:8080/zstack/v1/ldap/servers
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) The detailed description of the resource. 0.6
url String body (contained in the params structure) The URL of the LDAP server. 0.6
base String body (contained in the params structure) The base DN of the LDAP server. 0.6
username String body (contained in the params structure) The username used to access the LDAP server. 0.6
password String body (contained in the params structure) The password. 0.6
encryption String body (contained in the params structure) The encryption method.
  • None
  • TLS
0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you add an AD/LDAP server in ZStack Cloud, you can synchronize users by adding the virtualIDSyncConfiguration option to SystemTags.
    • Format of the virtualIDSyncConfiguration option: virtualIDSyncConfiguration::{\"rules\":[{\"name\":\"name\",\"attribute\":\"cn\",\"type\":\"SYSTEM\",\"optional\":\"true\"},{\"name\":\"fullname\",\"attribute\":\"cn\",\"type\":\"CUSTOM\",\"optional\":\"true\"}]}
    • Example: virtualIDSyncConfiguration::{\"rules\":[{\"name\":\"name\",\"attribute\":\"cn\",\"type\":\"SYSTEM\",\"optional\":\"true\"},{\"name\":\"fullname\",\"attribute\":\"cn\",\"type\":\"CUSTOM\",\"optional\":\"true\"}]}
  • When you add an AD/LDAP server in ZStack Cloud, you can synchronize organizations by adding the organizationSyncConfiguration option to SystemTags.
    • Format of the organizationSyncConfiguration option: organizationSyncConfiguration::{\"rules\":[{\"name\":\"name\",\"attribute\":\"distinguishedName\",\"type\":\"SYSTEM\",\"optional\":\"true\"},{\"name\":\"description\",\"attribute\":description,\"type\":\"SYSTEM\",\"optional\":\"true\"}],\"strategy\":\"Group\"}
    • Example: organizationSyncConfiguration::{\"rules\":[{\"name\":\"name\",\"attribute\":\"distinguishedName\",\"type\":\"SYSTEM\",\"optional\":\"true\"},{\"name\":\"description\",\"attribute\":description,\"type\":\"SYSTEM\",\"optional\":\"true\"}],\"strategy\":\"Group\"}
Note:
  • When you add AD/LDAP, the system will automatically check whether the server, port, base DN, login attribute, user DN, and password are correct. The waiting time does not exceed 5 seconds.

API Response

Sample Response
{ "inventory": { "uuid": "ef7291bd94ce478880938851e3ff6ad6", "name": "miao", "description": "miao desc", "url": "ldap://localhost:1888", "base": "dc\u003dexample,dc\u003dcom", "username": "", "password": "", "encryption": "None"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory LdapServerInventory See inventory. 0.6
#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. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
url String 0.6
base String The base DN of the LDAP server. 0.6
username String The username used to access the LDAP server. 0.6
password String The password. 0.6
encryption String The encryption method. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK
AddLdapServerAction action = new AddLdapServerAction(); action.name = "miao"; action.description = "miao desc"; action.url = "ldap://localhost:1888"; action.base = "dc=example,dc=com"; action.username = ""; action.password = ""; action.encryption = "None"; action.sessionId = "c805609607b94f1688e4f5791089ab6f"; AddLdapServerAction.Result res = action.call();
Python SDK
AddLdapServerAction action = AddLdapServerAction() action.name = "miao" action.description = "miao desc" action.url = "ldap://localhost:1888" action.base = "dc=example,dc=com" action.username = "" action.password = "" action.encryption = "None" action.sessionId = "611a70f771874450945f77465bca7642" AddLdapServerAction.Result res = action.call()

DeleteLdapServer

API Request

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

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
DeleteLdapServerAction action = new DeleteLdapServerAction(); action.uuid = "0e757aebf26346c19ee1f163ea9f0915"; action.deleteMode = "Permissive"; action.sessionId = "3dae39cdbba749ba91deda6b854695ec"; DeleteLdapServerAction.Result res = action.call();
Python SDK
DeleteLdapServerAction action = DeleteLdapServerAction() action.uuid = "7755f302acd44c62833f9d4eb3f7327c" action.deleteMode = "Permissive" action.sessionId = "61e33f5ab13b44ef873ef7fc719d3804" DeleteLdapServerAction.Result res = action.call()

QueryLdapServer

API Request

URLs
GET zstack/v1/ldap/servers GET zstack/v1/ldap/servers/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 940b9dba281d40b897497a95e8a0e942" \ -X GET http://localhost:8080/zstack/v1/ldap/servers?q=name=ldap server
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth e4e74e66dc074b24b7071b43b12240a2" \ -X GET http://localhost:8080/zstack/v1/ldap/servers/c898d74cdcb94ac4b3b28ac6b7a8f7f5

Queryable Fields

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

API Response

Sample Response
{ "inventories": [     { "uuid": "91820f68407a441c9ba031ac15fa322d", "name": "miao", "description": "miao desc", "url": "ldap://localhost:1888", "base": "dc\u003dexample,dc\u003dcom", "username": "", "password": "", "encryption": "None"     }   ] }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#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. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
url String 0.6
base String The base DN of the LDAP server. 0.6
username String The username used to access the LDAP server. 0.6
password String The password. 0.6
encryption String The encryption method. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK
QueryLdapServerAction action = new QueryLdapServerAction(); action.conditions = asList("name=ldap server"); action.sessionId = "a8d28261d5b940c9bdd4712a511bd537"; QueryLdapServerAction.Result res = action.call();
Python SDK
QueryLdapServerAction action = QueryLdapServerAction() action.conditions = ["name=ldap server"] action.sessionId = "aee6bc43a2fb4f1eb6c35e3a064dd464" QueryLdapServerAction.Result res = action.call()











Archives

Download Document Archives

Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.