:original_name: ddm_api_01_0043.html .. _ddm_api_01_0043: Querying DDM Accounts ===================== Function -------- This API is used to query DDM accounts. Constraints ----------- None URI --- GET /v1/{project_id}/instances/{instance_id}/users?offset={offset}&limit={limit} .. table:: **Table 1** Path parameters =========== ========= ====== =============== Parameter Mandatory Type Description =========== ========= ====== =============== project_id Yes String Project ID instance_id Yes String DDM instance ID =========== ========= ====== =============== .. table:: **Table 2** Query parameters +-----------------+-----------------+-----------------+--------------------------------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +=================+=================+=================+========================================================================================================+ | offset | No | Integer | Index offset. | | | | | | | | | | The query starts from the next piece of data indexed by this parameter. The value is **0** by default. | | | | | | | | | | The value must be a positive integer. | +-----------------+-----------------+-----------------+--------------------------------------------------------------------------------------------------------+ | limit | No | Integer | A maximum of DDM accounts to be queried. | | | | | | | | | | Value range: 1 to 128. | | | | | | | | | | If the parameter value is not specified, 10 accounts are queried by default. | +-----------------+-----------------+-----------------+--------------------------------------------------------------------------------------------------------+ Request Parameters ------------------ .. table:: **Table 3** Request header parameters +-----------------+-----------------+-----------------+----------------------------------------------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +=================+=================+=================+======================================================================================================================+ | X-Auth-Token | Yes | String | User token. | | | | | | | | | | It can be obtained by calling an IAM API. The value of **X-Subject-Token** in the response header is the user token. | +-----------------+-----------------+-----------------+----------------------------------------------------------------------------------------------------------------------+ Response Parameters ------------------- **Status code: 200** .. table:: **Table 4** Response body parameters +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ | Parameter | Type | Description | +==============+=============================================================================================================+==================================+ | users | Array of :ref:`GetUsersListDetailResponses ` objects | DDM account information | +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ | page_no | Integer | Current page | +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ | page_size | Integer | Data records on the current page | +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ | total_record | Integer | Total records | +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ | total_page | Integer | Total pages | +--------------+-------------------------------------------------------------------------------------------------------------+----------------------------------+ .. _ddm_api_01_0043__response_getuserslistdetailresponses: .. table:: **Table 5** GetUsersListDetailResponses +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | Parameter | Type | Description | +=======================+===============================================================================================+=================================================================================================================+ | name | String | Username of the DDM account | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | status | String | Status of the DDM account | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | base_authority | Array of strings | Basic permissions of the DDM account. | | | | | | | | The value can be **CREATE**, **DROP**, **ALTER**, **INDEX**, **INSERT**, **DELETE**, **UPDATE**, or **SELECT**. | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | description | String | Description of the DDM account | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | created | String | Time when the DDM account is created. The format is yyyy-mm-ddThh:mm:ssZ. | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ | databases | Array of :ref:`GetUsersListdatabase ` objects | Associated schemas | +-----------------------+-----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+ .. _ddm_api_01_0043__response_getuserslistdatabase: .. table:: **Table 6** GetUsersListdatabase =========== ====== ================================================== Parameter Type Description =========== ====== ================================================== name String Name of the schema associated with the DDM account description String Schema description =========== ====== ================================================== **Status code: 400** .. table:: **Table 7** Response body parameters =============== ====== ================== Parameter Type Description =============== ====== ================== errCode String Service error code externalMessage String Error message =============== ====== ================== **Status code: 500** .. table:: **Table 8** Response body parameters =============== ====== ================== Parameter Type Description =============== ====== ================== errCode String Service error code externalMessage String Error message =============== ====== ================== Example Request --------------- .. code-block:: text GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/users?offset={offset}&limit={limit} Example Response ---------------- **Status code: 200** OK .. code-block:: { "users" : [ { "name" : "ddmtest", "status" : "RUNNING", "base_authority" : [ "SELECT" ], "description" : "Account", "created" : "2019-10-30T11:01:24+0800", "databases" : [ { "name" : "test", "description" : "Schema" } ] } ], "page_no" : 1, "page_size" : 10, "total_record" : 1, "total_page" : 1 } **Status code: 400** bad request .. code-block:: { "externalMessage" : "Parameter error.", "errCode" : "DBS.280001" } **Status code: 500** server error .. code-block:: { "externalMessage" : "Server failure.", "errCode" : "DBS.200412" } Status Codes ------------ =========== ============ Status Code Description =========== ============ 200 OK 400 bad request 500 server error =========== ============ Error Codes ----------- For details, see :ref:`Error Codes `.