A MilvusClient interface. This method creates an authenticated user access.

R<RpcStatus> createCredential(CreateCredentialParam requestParam);


Use the CreateCredentialParam.Builder to construct a CreateCredentialParam object.

import io.milvus.param.CreateCredentialParam;
CreateCredentialParam.Builder builder = CreateCredentialParam.newBuilder();

Methods of CreateCredentialParam.Builder:

withUsername(String username)Sets the username. The username cannot be empty or null.username: The username used to create the credential.
withPassword(String password)Sets the password. The password cannot be empty or null.password: The corresponding password used to create the credential.
build()Constructs a CreateCredentialParam object.N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R<RpcStatus> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknow and the error message of the exception.

  • If the API succeeds, it returns R.Status.Success.


import io.milvus.param.*;

CreateCredentialParam param = CreateCredentialParam.newBuilder()
R<RpcStatus> response = client.createCredential(param)
if (response.getStatus() != R.Status.Success.getCode()) {