All Products
Search
Document Center

AI Coding Assistant Lingma:API integration

Last Updated:Apr 03, 2025

APIs for user data queries, provided by the enterprise, can be integrated with AI Coding Assistant Lingma (Lingma) to enable the synchronization of user data and organization structure.

Supported editions

Enterprise Dedicated

Create users outside the sync scope

Administrators can configure API integration in Enterprise Settings > Identity Providers. Make sure the API aligns with the requirements outlined later in this article. You can create users outside the sync scope by selecting Support for built-in users: You can create users outside the sync scope.

image

Configure API integration

Step 1: Configure the data request URL

a. Enter the data request URL. Both HTTP and HTTPS are supported. Make sure the API is accessible.

b. Click Next once the test for API access passes.

Note
  1. The API only supports HTTP/HTTPS GET requests.

  2. Append parameters to the URL to authenticate the API calls.

  3. For pagination, add the following parameters to the URL:

    • page_number=0 (starting page)

    • page_size=10 (items per page).

      Example: https://xxxxxx?page_number=0&page_size=10

image

Response of the API calls

The response should be structured as the following sample:

{
  "users": [
    {
      "user_id": "yx12346xxx",
      "name": "zhoux",
      "user_name": "zhouxxx",
      "nick_name": "xxwai",
      "staff_id": "004xx5",
      "email": "zhouxxx@alibaba-inc.com",
      "department_ids": [
        "16xxx2"
      ]
    }
  ],
  "departments": [
    {
      "department_id": "A_id",
      "name": "A",
    },
    {
      "department_id": "B_id",
      "name": "B",
      "parent_id": "A_id"
    }
  ],
  "next_page_number": 1
}

The departments returned as a list contains all departments that users belong to. Pagination must base on the number of users, and the data of parent department must be returned before child department (for example, if department A is the parent of department B, the data of department A must be listed in the departments before the data of department B. See sample response above).

API Response Field Reference

Name

Type

Required

Description

User

user_id

string

Yes

User ID, globally unique

name

string

Yes

User name

user_name

string

Yes

User account name, globally unique

nick_name

string

No

User nickname

staff_id

string

No

Employee ID, globally unique

email

string

Yes

User email, globally unique

status

string

No

Employment status. "leave" means the user is resigned. Lingma will delete users with the status of leave.

department_ids

array

Yes

String array, containing the unique identity of the department the user belongs to

Department

department_id

string

Yes

Department ID

name

string

Yes

Department name

parent_id

string

Yes

Parent department ID, used to generate the organizational architecture

Pagination

next_page_number

int

No

If pagination is required, set the page number returned by the last page to -1 to end the paging.

Step 2: Configure user sync

a. Fill in the following fields.

b. Click Next once you have finished filling in all the fields.

image

System will link accounts with any of the following matching attributes across the API and Lingma:

  • Link Accounts with Same Email

  • Link Accounts with Same Username

  • Link Accounts with Same Mobile Number

  • Link Accounts with Employee ID

Ensure the uniqueness and existence of the attribute, as Lingma will perform one-to-one account matching based on it. The following picture explains the procedure of linking accounts.

image

Step 3: Enable the synchronization of organizations and users

a. Enable the sync between organizations and users on Lingma when no other third-party synchronization services are active. You can configure the synchronization timing and user and organization difference handling rules.

image

b. User synchronization can also be enabled later on the Identity Providers page by clicking Enable Services.

image

c. To finalize all configurations, click the Save Configuration button.

  • Data synchronization supports both manual and scheduled execution.

    • Manual synchronization: Administrator need to manually execute synchronization by selecting Manual on the product page.

      Note

      Manual synchronization operations should be spaced at least one hour apart.

    • Scheduled synchronization: can be set daily, weekly, monthly, or at regular intervals. It is suggested to perform a manual synchronization after saving the scheduled settings, to synchronize the current data to Lingma.

  • User data synchronization rules

    Default Behavior:

    • Ignore redundant Lingma accounts not mapped to third-party sources.

    • Create Lingma accounts for third-party accounts within the sync scope if no corresponding accounts exist, and bind them using defined rules.

    • Customizable Settings:

      Scenario

      Handling Mode Options

      Existing Lingma accounts, not linked to third-party accounts

      - Ignore: retained in Lingma without deletion.

      - Delete: removed during synchronization.

      Existing third-party accounts, not linked to Lingma accounts

      - Ignore: no Lingma account has been created.

      - Create & Bind: new Lingma account created and associated with the third-party account via binding and attribute mapping rules.

  • Department synchronization policies

    Default Behavior:

    • Ignore redundant Lingma departments not mapped to third-party sources.

    • Create Lingma departments for third-party accounts within the sync scope if no corresponding departments exist, and bind them.

      • Customizable Settings:

        Scenario

        Handling Mode Options

        Existing Lingma departments, not linked to third-party departments

        - Ignore: retained in Lingma without deletion.

        - Delete: removed during synchronization.

        Existing third-party departments, not linked to Lingma departments

        - Ignore: no Lingma department is created.

        - Create & Bind: new Lingma department created and linked to the third-party department.

View user and organization synchronization results

When Sync of Organizations and Users is enabled, you can see the latest sync results on the Identity Providers page. The results can be: No sync done, Sync successful, Sync failed, or Partly successful.

image

Disable the synchronization of organizations and users

You can disable the synchronization of organizations and users on Identity Providers page, which will result in:

  • Lingma accounts remain bound to third-party accounts.

  • User and organization synchronization for third-party systems will not be executed.

Remove the API integration

To remove the API integration, click the Remove Integration button on the Identity Providers page, which will result in:

  • Unbind Lingma accounts from third-party accounts.

  • The synchronized user and organizational structure will not be affected.

image