Skip to main content

Open API

Overview

The basic process for calling the SERVICEME Open API:

Step 1: Use the interface provided in the authentication section to perform identity authentication and obtain an access token

​There are two types of authentication: user authentication and client authentication.

  • User authentication: Authentication based on a personal account identity.
  • Client authentication: Authentication using the client code and secret issued by SERVICEME.

Step 2: Use the access token to call the corresponding API

Authentication Methods

User AAD Authentication

This method is a type of user authentication and requires the use of an AAD access token as the basis for identity authentication.

  • How to obtain an AAD access token:

    AAD and React integration documentation: Go to->

    AAD and .Net integration documentation: Go to->

    AAD and Java integration documentation: Go to->

  • API endpoint: /openapi/auth/user/aad

  • Request method: post

  • Request body:

Parameter NameRequiredTypeDescription
tokenYesstringUser AAD access token (provided by integrator)
  • API request example:
curl --location 'https://localhost/openapi/auth/user/aad' \
--header 'Content-Type: application/json' \
--data '{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlhSdmtvOFA3QTNVYVdTblU3Yk05blQwTWpoQSJ9.eyJhdWQiOiIzZTEwNjVhYS1jZWYxLTRiYTgtOWRiOS1kMWQ1Y2UzMGYyZDgiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vNDRjMjRmNDItZDQ5Yi00MT......"
}'
  • Response body:
Parameter NameSub-parameterTypeDescription
dataobjectResponse data
access_tokenstringSERVICEME system access token
expires_innumberExpiration time, in minutes
successbooleanWhether the request was successful
msgstringIf success is false, this field contains error messages
  • Response example:
{
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0V4dGVybmFsIjpmYWxzZSwidXNlcklkIjoiNDAzMDUwMjEwMTEyODgzOTE2OCIsImFjY291bnQiOiJlY210cmlhbEBzZXJ2aWNlbWUub25taWNyb3NvZ......",
"expires_in": 1440
},
"success": true,
"msg": ""
}

Client and User Account Authentication

This authentication method combines client authentication and user account authentication. Identity authentication is performed through the user account, and client credentials (client id and secret) are also required to ensure the security of API calls. Signature verification is required when calling this interface.

  • How to obtain client and secret?

The system administrator creates credentials through the client management interface {domain}#/super-admin/client-management. After creation, the client id and secret can be obtained.

  • API endpoint: /openapi/auth/client_with_account

  • Request method: post

  • Request body:

Parameter NameRequiredTypeDescription
clientYesstringClient Id
accountYesstringUser account (corresponds to UserName in user management)
timestampYesnumberTimestamp (13-digit number, accurate to milliseconds, e.g. 1711537596897)
nonceYesstring6-digit random string (can be a combination of numbers or letters)
signatureYesstringSignature, valid within five minutes (Signature format: concatenate with colons and then MD5 client:{client}secret:{secret}account:{account}timestamp:{timestamp}nonce:{nonce}; the resulting 32-character lowercase MD5 value)
  • JavaScript signature example:

    Please create a new HTML file, paste the following content, and open it in your browser

    <html>
    <head>
    <style>
    .box {
    width: 100%;
    height: 100%;
    padding: 50px 50px;
    }
    .row {
    display: flex;
    height: 50px;
    width: 100%;
    }
    .col1 {
    flex: 1;
    }
    .col2 {
    flex: 3;
    }
    </style>
    </head>
    <body>
    <div class="box">
    <div class="row">
    <div class="col1">client:</div>
    <div class="col2" id="client"></div>
    </div>
    <div class="row">
    <div class="col1">secret:</div>
    <div class="col2" id="secret"></div>
    </div>
    <div class="row">
    <div class="col1">account:</div>
    <div class="col2" id="account"></div>
    </div>
    <div class="row">
    <div class="col1">timestamp:</div>
    <div class="col2" id="timestamp"></div>
    </div>
    <div class="row">
    <div class="col1">nonce:</div>
    <div class="col2" id="nonce"></div>
    </div>
    <div class="row">
    <div class="col1">signature:</div>
    <div class="col2" id="signature"></div>
    </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
    <script>
    const client = "openapi"
    const secret = "DzYwyICrKbUCEseYthCK0PfSfX7NPEuV"
    const account = "test@serviceme.com"
    const timestamp = +new Date()
    const nonce = "123abc"
    const message = `client:${client}secret:${secret}account:${account}timestamp:${timestamp}nonce:${nonce}` // Signature plaintext
    const md5Hash = CryptoJS.MD5(message).toString().toLowerCase(); // MD5 32-bit lowercase

    console.log(`Signature plaintext: ${message}`)
    console.log(`Signature result: ${md5Hash}`)

    document.getElementById('client').innerText = client;
    document.getElementById('secret').innerText = secret;
    document.getElementById('account').innerText = account;
    document.getElementById('timestamp').innerText = timestamp;
    document.getElementById('nonce').innerText = nonce;
    document.getElementById('signature').innerText = md5Hash;
    </script>
    </body>
    </html>
  • API request example:

curl --location 'https://localhost/openapi/auth/client_with_account' \
--header 'Content-Type: application/json' \
--data '{
"client": "openapi",
"account": "test@serviceme.com",
"timestamp": 1711537596456,
"nonce": "123abc",
"signature": "182be0c5cdcd5072bb1864cdee4d3d6e"
}'
  • Response body
Parameter NameSub-parameterTypeDescription
dataobjectResponse data
access_tokenstringSERVICEME system access token
expires_innumberExpiration time, in minutes
successbooleanWhether the request was successful
msgstringIf success is false, this field contains error messages
  • API response example:
{
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0V4dGVybmFsIjpmYWxzZSwidXNlcklkIjoiNDAzMDUwMjEwMTEyODgzOTE2OCIsImFjY291bnQiOiJlY210cmlhbEBzZXJ2ub25ta......",
"expires_in": 1440
},
"success": true,
"msg": ""
}

Chat

Send Message to Agent

  • API endpoint: /openapi/chat/expert

  • Request method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request body:
Parameter NameRequiredTypeDescription
expertCodeYesstringAgent code in the SERVICEME system (see SERVICEME system)
contentYesstringQuestion content
sessionIdNostringSession id, represents a chat context; passing null starts a new session, the new session id will be returned in the response. From the second Q&A onwards, you need to carry the session id returned from the previous response to continue.
streamNobooleanWhether to enable streaming (true: on; false: off), default is off
includeThoughtNobooleanWhether to include thoughts in the response content (true: include; false: do not include)

How to obtain the Q&A code? See the image below:

img

  • Request example:
curl --location 'https://localhost/vee/openapi/chat/expert' \
--header 'Authorization: openapi {access_token}' \
--header 'Content-Type: application/json' \
--data '{
"expertCode": "CHATES",
"content": "加班申请",
"sessionId": null,
"stream": false,
"includeThought": true
}'
  • Response body:
ParameterSub-parameterSub-sub-parameterSub-sub-sub-parameterTypeDescription
dataobjectResponse data
chatRecordIdstringChat record id
sessionIdstringSession id
contentstringText-type answer information
mediasobjectArray of media-type answer information (images, files, etc.)
typestringimage: image; file: file
namestringName
suggestionQuestionsarray stringSuggested questions
thoughtsarrayThoughts
thoughtstringThought content
pluginNamestringPlugin name
elapsedTimeobjectPlugin elapsed time information
modelfloatModel elapsed time
actionfloatAction elapsed time
totalfloatTotal elapsed time
statestringState (success: successful)
finish_reasonstringWhether the answer is finished; value "stop" means finished, null during answering
successbooleanWhether the request was successful
msgstringIf success is false, this field contains error messages
  • Non-streaming response example:
{
"data": {
"chatRecordId": "4299234148041625600",
"sessionId": "4292755814873047040",
"content": "The team leader issues work tasks, clarifies completion milestones and acceptance criteria, and employees can only work overtime after reaching an agreement with their supervisor. After working overtime, employees fill in overtime hours in the time system, submit the overtime process in the system, and clearly state the overtime tasks in the remarks. Complete clock-in and clock-out records must be kept at the workplace. After the team leader/supervisor accepts the overtime results, the overtime application process is approved. HR confirms the clock-in records and calculates compensatory leave.",
"medias": [
{
"type": "image",
"name": null,
"url":"http://localhost:3978/openapi/chat/media/image/FE680A9CCFB1B56E80737FB28562DC33F4A37DEF52A65F046464788B83E0BE77"
},
{
"type": "file",
"name": "答案参考文件.pdf",
"url":"https://localhost/#/share/preview?fileId=4268457334348447744&objectType=2&previewType=file&mode=login"
},
],
"suggestionQuestions": [],
"thoughts": [
{
"thought": "To answer this question, I need to query relevant information in the knowledge base.",
"pluginName": "Search Knowledgebase",
"elapsedTime": {
"model": 3612.4722,
"action": 689.5891,
"total": 4302.0613
},
"state": "success"
}
],
"finish_reason": "stop"
},
"success": true,
"msg": ""
}
  • Streaming response example:
data: {"data":{"chatRecordId":"4299228743576059904","sessionId":"4292755079242457089","content":"","medias":[],"suggestionQuestions":[],"thoughts":[{"thought":"To answer this question, I need to query relevant information in the knowledge base.","pluginName":"Search Knowledgebase","elapsedTime":{"model": 3612.4722,"action": 689.5891,"total": 4302.0613},"state": "success"}],"finish_reason":null},"success":true,"msg":""}

data: {"data":{"chatRecordId":"4299228743576059904","sessionId":"4292755079242457089","content":"The team leader issues work tasks, clarifies completion milestones and acceptance criteria, and employees can only work overtime after reaching an agreement with their supervisor. After working overtime, employees fill in overtime hours in the time system, submit the overtime process in the system, and clearly state the overtime tasks in the remarks. Complete clock-in and clock-out records must be kept at the workplace. After the team leader/supervisor accepts the overtime results, the overtime application process is approved. HR confirms the clock-in records and calculates compensatory leave.","medias":[],"suggestionQuestions":[],"thoughts":[],"finish_reason":null},"success":true,"msg":""}

data: {"data":{"chatRecordId":"4299228743576059904","sessionId":"4292755079242457089","content":"","medias":[{"type":"image","name":null,"url":"http://localhost:3978/openapi/chat/media/image/FE680A9CCFB1B56E80737FB28562DC33F4A37DEF52A65F046464788B83E0BE77"}],"suggestionQuestions":[],"thoughts":[],"finish_reason":null},"success":true,"msg":""}

data: {"data":{"chatRecordId":"4299228743576059904","sessionId":"4292755079242457089","content":"","medias":[{"type":"file","name":"答案参考文件.pdf","url":"https://localhost/#/share/preview?fileId=4268457334348447744&objectType=2&previewType=file&mode=login"}],"suggestionQuestions":[],"thoughts":[],"finish_reason":"stop"},"success":true,"msg":""}

Get References for a Conversation

  • API endpoint: /openapi/chat/record/{chatRecordId}/reference

  • Request method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request URL parameters:
Parameter NameRequiredTypeDescription
chatRecordIdYesstringValue taken from the chatRecordId field returned by the Q&A interface
  • Request example:
curl --location 'http://localhost/openapi/chat/record/4299234148041625600/reference' \
--header 'Authorization: openapi {access_token}'
  • Response body:
Parameter NameSub-parameterTypeDescription
dataobject arrayResponse data
titlestringTitle
contentstringContent of the referenced fragment in this chat record
scorefloatRelevance (0 to 1, the closer to 1, the more relevant)
urlstringLink (currently only file-type references have links)
typestringType enum: document, image, QnA, other
successbooleanWhether the request was successful
msgstringIf success is false, this field contains error messages
  • Response example:

json
{
"data": [
{
"title": "Company Administrative Policy.pdf",
"content": "Fragment One ......",
"score": 0.95,
"url": "https://localhost/#/share/preview?fileId=4268457334348447744&objectType=2&previewType=file&mode=login",
"type": "document"
},
{
"title": "Company Administrative Policy.pdf",
"content": "Fragment Two ......",
"score": 0.81,
"url": "https://localhost/#/share/preview?fileId=4268457334348447744&objectType=2&previewType=file&mode=login",
"type": "document"
},
{
"title": "Company Administrative Policy.pdf",
"content": "Fragment Three ......",
"score": 0.76,
"url": "https://localhost/#/share/preview?fileId=4268457334348447744&objectType=2&previewType=file&mode=login",
"type": "document"
}
],
"success": true,
"msg": ""
}

File Workspace

Single File Upload

  • API Endpoint: v1/openapi/workspace/file/upload

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Content Type: form-data
  • Request body:
Parameter NameRequiredTypeDescription
workspaceYesstringFile workspace
fileYesfileFile (single)
eponymousCoverNoboolWhether to overwrite if a file with the same name exists (default: do not overwrite)
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/file/upload' \
--header 'Authorization: openapi {access_token}' \
--form 'workspace="Test Workspace"' \
--form 'file=@"/C:/test.doc"' \
--form 'eponymousCover="false"'
  • Response body:
Parameter NameSub-parameterTypeDescription
dataobjectResponse data
fileIdstringFile id
fileNamestringFile name
uploaderstringUploader
successbooleanWhether successful
msgstringIf success is false, this field contains error messages
  • Response Example:
{
"data": {
"fileId": "4345229404125790208",
"fileName": "test.doc",
"uploader": "test@serviceme.com"
},
"success": true,
"msg": ""
}

Batch File Upload

Submit Files

  • API Endpoint: v1/openapi/workspace/file/upload/batchSubmit

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Content Type: form-data
  • Request body:
Parameter NameRequiredTypeDescription
workspaceYesstringFile workspace
filesYesfileFiles (multiple)
eponymousCoverNoboolWhether to overwrite if a file with the same name exists (default: do not overwrite)
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/file/upload/batchSubmit' \
--header 'Authorization: openapi {access_token}' \
--form 'workspace="Test Workspace"' \
--form 'files=@"/C:/test1.doc"' \
--form 'files=@"/C:/test2.docx"' \
--form 'eponymousCover="false"'
  • Response body:
Parameter NameSub-parameterTypeDescription
dataobjectResponse data
stateIdstringUpload state id, use this id to poll for the latest upload result
successbooleanWhether successful
msgstringIf success is false, this field contains error messages
  • Response Example:
{
"data": {
"stateId": "4345229404125790208"
},
"success": true,
"msg": ""
}

Query Upload Result

  • API Endpoint: v1/openapi/workspace/file/upload/batchSubmit/{stateId}

  • Request Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request URL Parameters:
Parameter NameRequiredTypeDescription
stateIdYesstringThe stateId field value returned by the batch file upload API
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/file/upload/batchSubmit/4345227891722682368' \
--header 'Authorization: openapi {access_token}'
  • Response body:
Parameter NameSub-parameterTypeDescription
dataobject arrayResponse data
fileIdstringFile Id
fileNamestringFile name
statestringState enum: underway (in queue), success, fail
uploaderstringUploader
errorMsgstringIf state is fail, the reason for failure
finishTimestringFile processing completion time
successbooleanWhether successful
msgstringIf success is false, this field contains error messages
  • Response Example:
{
"data": [
{
"fileId": "4345227925730099200",
"fileName": "test1.doc",
"state": "success",
"uploader": "test@serviceme.com",
"errorMsg": "",
"finishTime": "2024-08-17T05:04:30.0128596Z"
},
{
"fileId": "4345227924266287104",
"fileName": "test2.docx",
"state": "success",
"uploader": "test@serviceme.com",
"errorMsg": "",
"finishTime": "2024-08-17T05:04:29.7952274Z"
}
],
"success": true,
"msg": ""
}

QnA Creation

  • API Endpoint: v1/openapi/workspace/qna/create

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request body:
Parameter NameSub-parameterRequiredTypeDescription
workspaceYesstringFile workspace
questionsYesstring arrayArray of questions, multiple allowed
answerYesstringAnswer
metadatasNoobject arrayMetadata
typeCodeYesstringMetadata type
contentYesstringContent
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/qna/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: openapi {access_token}' \
--data '{
"questions": [
"Test question"
],
"answer": "Test answer",
"workspace": "Test Workspace",
"metadatas": [
{
"typeCode": "Document type",
"content": "Test metadata"
}
]
}'
  • Response body:
Parameter NameTypeDescription
successbooleanWhether successful
msgstringIf success is false, this field contains error messages
  • Response Example:
{
"success": true,
"msg": ""
}

Query Files

  • API Endpoint: v1/openapi/workspace/file

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request body:
Parameter NameRequiredTypeDescription
workspaceYesstringFile workspace
pageIndexNonumberPage number, default is first page
pageSizeNonumberNumber of items to retrieve, default is 10
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/file' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"workspace": "Test Workspace",
"pageIndex": 1,
"pageSize": 10
}'
  • Response body:

    Parameter NameSub-parameterSub-sub-parameterTypeDescription
    dataobject arrayResponse data
    idstringFile id
    namestringFile name
    sizenumberFile size, in bytes
    descriptionstringDescription
    fullPathstringFile path
    tagsobject arrayFile tag information
    idstringTag id
    valuestringTag value
    chunkingStatestringFile index state: waiting, success, fail, underway
    previewStatestringFile preview state: waiting, success, fail, underway
    fileCanPreviewbooleanWhether file can be previewed, true: yes; false: no
    previewUrlstringFile preview URL
    createdByRealNamestringFile creator name
    createdByAccountstringFile creator account
    createddatetimeFile creation time
    modifiedByRealNamestringFile editor name
    modifiedByAccountstringFile editor account
    modifieddatetimeFile modification time
    successbooleanWhether successful
    msgstringIf success is false, this field contains error messages
  • Response Example:

{
"data": [
{
"id": "4339013367831199744",
"name": "test.docx",
"size": 15113,
"description": null,
"fullPath": "/",
"tags": [],
"chunkingState": "success",
"previewState": "success",
"fileCanPreview": true,
"previewUrl": "http://localhost.com/#/share/preview?fileId=4339013367831199744&objectType=2&previewType=file&mode=login",
"createdByRealName": "test",
"createdByAccount": "test",
"created": "2024-07-31T01:30:02.88",
"modifiedByRealName": "test",
"modifiedByAccount": "test",
"modified": "2024-07-31T01:30:02.88"
}
],
"pageSize": 10,
"pageIndex": 1,
"totalCount": 1,
"success": true,
"msg": ""
}

Query File Fragments

  • API Endpoint: v1/openapi/workspace/file/chunk

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request body:
Parameter NameRequiredTypeDescription
fileIdYesstringFile id
imageFormatNostringImage format, markdown or html, default is markdown output
pageIndexNonumberPage number, default is first page
pageSizeNonumberNumber of items to retrieve, default is 10
  • Request Example:
curl --location 'http://localhost/v1/openapi/workspace/file/chunk' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"fileId": "4344174161665458176",
"imageFormat": "html",
"pageIndex": 1,
"pageSize": 10
}'
  • Response body:

    Parameter NameSub-parameterSub-sub-parameterTypeDescription
    dataobject arrayResponse data
    idstringFragment id
    contentstringFragment content
    successbooleanWhether successful
    msgstringIf success is false, this field contains error messages
  • Response Example:


json
{
"data": [
{
"id": "4339013367831199744",
"content": "test"
}
],
"pageSize": 10,
"pageIndex": 1,
"totalCount": 1,
"success": true,
"msg": ""
}

RAG

  • API Endpoint: /v1/openapi/rag

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Request body:
Parameter NameTypeRequiredDefaultDescription
querystringNoNoneThe question or content to be retrieved. Cannot be null at the same time as the Keywords parameter.
keywordsstringNoNoneKeywords, multiple keywords separated by |. Cannot be null at the same time as the Query parameter. If null, keywords will be extracted as needed; if not empty, the provided keywords will be used directly.
workspacesarrayNoNoneNames or IDs of the file spaces to be searched in this RAG. If this value is provided, only these spaces will be searched.
ragObjectRagObjectYes0RAG object type, enum value (see RagObject Enum).
topknumberYesNoneNumber of results to return.
minSimilaritydoubleNo0.8Minimum similarity, range [0, 1].
metadataFilterarrayNoNoneTypes of metadata filters to use. Currently only the default filter is supported.
ragModeSearchModeYes0RAG mode, enum value (see SearchMode Enum).
weightsobjectNoNoneRRF weights for each index, only effective when RagMode is Hybrid. If null, default weights are used.
rerankerstringNoNoneIf null, reranker will not be used.

  • Request Example:
curl --location 'http://localhost/v1/openapi/rag' \
--header 'Authorization: ••••••' \
--header 'Content-Type: application/json' \
--data '{
"query": "什么是人工智能?",
"keywords": "AI|机器学习",
"workspaces": ["workspace1", "workspace2"],
"ragObject": 0,
"topk": 3,
"minSimilarity": 0.8,
"metadataFilter": ["default"],
"ragMode": 1,
"weights": {
"Embedding": 0.9,
"FullText": 0.8
},
"reranker": "default"
} '
  • Response body:
Field NameTypeDescription
dataobjectResponse data object, containing search results and search ID, etc.
data.resultsarrayList of search results, each element is an object containing chunk information.
data.results[].chunkIdstringChunk ID
data.results[].fileIdstringFile ID to which the chunk belongs
data.results[].fileNamestringFile name to which the chunk belongs
data.results[].contentstringChunk content
data.results[].metadatajsonChunk metadata
data.results[].urlstringURL address of the chunk (if any)
data.results[].searchScoredoubleSimilarity score
data.results[].rrfScoredoubleRRF score
data.results[].rerankScoredoubleRerank score
data.results[].workspaceIdstringWorkspace ID to which the file belongs
data.results[].workspaceNamestringWorkspace name to which the file belongs
data.searchIdstringUnique identifier for this search operation
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)

  • Response Example:
{
"data": {
"results": [
{
"chunkId": "4422442085118906369",
"fileId": "4417076017114382336",
"fileName": "文件1.pdf",
"content": "……",
"metadata": {
"Url": "https://……",
"FileName": "文件1.pdf",
"WorkspaceName": "workspace1",
"FileId": "4417076017114382336",
"FilePath": "/",
"Created": "2025-03-03T11:23:08.803",
"Size": "1160594"
},
"url": "https://……",
"searchScore": 0.153852914388501,
"rrfScore": 0.8768274796195331,
"rerankScore": 0.0,
"workspaceId": "4417069258022846464",
"workspaceName": ""
},
{
"chunkId": "4422442085114712073",
"fileId": "4417076017114382336",
"fileName": "文件1.pdf",
"content": "……",
"metadata": {
"Url": "https://……",
"FileName": "文件1.pdf",
"WorkspaceName": "workspace1",
"FileId": "4417076017114382336",
"FilePath": "/",
"Created": "2025-03-03T11:23:08.803",
"Size": "1160594"
},
"url": "https://……",
"searchScore": 0.152822583517241,
"rrfScore": 0.8670604574184315,
"rerankScore": 0.0,
"workspaceId": "4417069258022846464",
"workspaceName": ""
},
{
"chunkId": "4422442085114712071",
"fileId": "4417076017114382336",
"fileName": "文件1.pdf",
"content": "……",
"metadata": {
"Url": "……",
"FileName": "文件1.pdf",
"WorkspaceName": "workspace1",
"FileId": "4417076017114382336",
"FilePath": "/",
"Created": "2025-03-03T11:23:08.803",
"Size": "1160594"
},
"url": "……",
"searchScore": 0.153708375384407,
"rrfScore": 0.8661891817471927,
"rerankScore": 0.0,
"workspaceId": "4417069258022846464",
"workspaceName": ""
}
],
"searchId": "4423568945336811520"
},
"success": true,
"msg": ""
}
  • Enum Types

RagObject Enum

Enum ValueEnum NumberDescription
Both0Retrieve both Q&A and document content.
Qna1Retrieve only Q&A content.
Doc2Retrieve only document content.

SearchMode Enum

Enum ValueEnum NumberDescription
Hybrid1Hybrid search mode, combining embedding and full-text search.
Embedding2Search mode based only on embeddings.
FullText3Search mode based only on full-text search.

  • Rerank Model Configuration Taking the configuration of the cohere-rerank-v3.5 model as an example:
INSERT INTO dbo.AI_LLM (Id,ModelName,TokenCount,Config,Enable,[Default],Display,DisplayName) VALUES
(4183721090264072898,N'rerank-v3.5',255454,N'{"RerankerName":"cohere","Uri":"https://domain/v2/rerank","Token":"bearer token"}',1,0,0,N'cohere-rerank-v3.5');

Note: If you are using the Cohere official API, the value of the Token field should be bearer token. If you are using the Azure AI Foundry API, the value of the Token field should remove bearer.

User

Add User (Batch Supported)

  • API Endpoint: v1/openapi/user

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
userNameYesstringNoneAccount/User name
passwordNostring''Password
activeNobooleantrueActive status
userInfoNoobjectNoneUser information
userInfo.realNameNostringValue of userNameReal name
userInfo.spellNostringNonePinyin of real name
userInfo.serialNumberNostringNoneEmployee number
userInfo.nickNameNostringNoneNickname
userInfo.genderNonumber0Gender 0:FEMALE, 1:MALE
userInfo.birthdayNostringNoneBirthday
userInfo.mobilePhoneNostringNoneMobile phone number
userInfo.emailNostringNoneEmail
userInfo.weChatNostringNoneWeChat ID
userInfo.avatarNostringNoneAvatar
userInfo.regionNostringNoneRegion
userInfo.joinTimeNostringNoneDate of joining
userInfo.sortNonumber0Sort number
userInfo.enableNobooleanfalseEnable/Disable
userInfo.descriptionNostringNoneDescription
userInfo.externalNobooleanfalseInternal/External user flag false: internal user, true: external user
userInfo.officePhoneNumberNostringNoneOffice phone number
userInfo.isAadNostringNoneWhether the account is from AAD (Microsoft Entra ID)
  • Request Example:
curl --location 'http://localhost/v1/openapi/user' \
--header 'Authorization: openapi {access_token}' \
--data '{
"userName": "user1",
"password": "abc123",
"active": true,
"userInfo": {
"realName": "张三",
"spell": "zhangsan",
"serialNumber": "123456",
"nickName": "张三",
"gender": 0,
"birthday": "1990-01-01",
"mobilePhone": "13800138000",
"email": "zhangsan@email.com",
"weChat": "zhangsan",
"avatar": "/icons/e5392a9c9efb423cab69ce040dcb04e7.png",
"region": "中国",
"joinTime": "2023-01-01",
"sort": 101,
"enable": true,
"description": "张三的描述",
"external": false,
"officePhoneNumber": "010-12345678",
"isAad": false
},
} '
  • Response body:
Field NameTypeDescription
dataobjectResponse data object
data.accountIdstringAccount ID
data.userIdstringUser ID
data.userNamestringUser name
data.realNamestringUser real name
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"accountId": "123456",
"userId": "123456",
"userName": "user1",
"realName": "张三"
}
]
}

Update User

  • API Endpoint: v1/openapi/user

  • HTTP Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in the SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
userNameNostringNoneAccount/User name, only used to find the user and will not be modified, cannot both be empty with id
idNostring''id, cannot both be empty with userName
activeNobooleantrueActive status
realNameNostringValue of userNameReal name
spellNostringNonePinyin of real name
serialNumberNostringNoneEmployee number
nickNameNostringNoneNickname
genderNonumber0Gender 0:FEMALE, 1:MALE
birthdayNostringNoneBirthday
mobilePhoneNostringNoneMobile phone number
emailNostringNoneEmail
weChatNostringNoneWeChat ID
avatarNostringNoneAvatar
regionNostringNoneRegion
joinTimeNostringNoneDate of joining
sortNonumber0Sort number
enableNobooleanfalseEnable/Disable
descriptionNostringNoneDescription
externalNobooleanfalseInternal/External user flag false: internal user, true: external user
officePhoneNumberNostringNoneOffice phone number
isAadNostringNoneWhether the account is from AAD (Microsoft Entra ID)
  • Request Example:
shell
curl --location 'http://localhost/v1/openapi/user' \
--header 'Authorization: openapi {access_token}' \
--data '{
"id": "123456",
"userName": "user1",
"realName": "Zhang San",
"spell": "zhangsan",
"serialNumber": "123456",
"nickName": "Zhang San",
"gender": 0,
"birthday": "1990-01-01",
"mobilePhone": "13800138000",
"email": "zhangsan@email.com",
"weChat": "zhangsan",
"avatar": "/icons/e5392a9c9efb423cab69ce040dcb04e7.png",
"region": "China",
"joinTime": "2023-01-01",
"sort": 101,
"enable": true,
"description": "Description of Zhang San",
"external": false,
"officePhoneNumber": "010-12345678",
"isAad": false
} '
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": ""
}

Delete User

  • Endpoint: v1/openapi/user

  • HTTP Method: delete

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
YesarrayNoneArray of user IDs or usernames. The array must contain only IDs or only usernames.
  • Request Example:
curl --location 'http://localhost/v1/openapi/user' \
--header 'Authorization: openapi {access_token}' \
--data '['user1','user2']'
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": ""
}

Enable User

  • Endpoint: v1/openapi/user/{userCode}/enable

  • HTTP Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Route parameters:
Parameter NameRequiredTypeDefaultDescription
userCodeYesstringNoneUser ID or username
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/123456/enable' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": ""
}

Disable User

  • Endpoint: v1/openapi/user/{userCode}/disable

  • HTTP Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Route parameters:
Parameter NameRequiredTypeDefaultDescription
userCodeYesstringNoneUser ID or username
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/123456/disable' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": ""
}

Enable/Disable Users (Batch Supported)

  • Endpoint: v1/openapi/user/enable

  • HTTP Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
codesYesarrayNoneArray of user IDs or usernames. The array must contain only IDs or only usernames.
operationYesbooleantruetrue: enable, false: disable
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/enable' \
--header 'Authorization: openapi {access_token}' \
--data '{
"codes": ['user1', 'user2'],
"operation": true
}'
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": ""
}

Get User List (Paginated)

  • Endpoint: v1/openapi/user/pageList

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
orderFieldYesstringNoneField for sorting. The ID contains time information, so sorting by id can be used as sorting by creation time.
orderTypeYesstringNoneSort type, asc: ascending, desc: descending
conditionsNoarrayNoneQuery conditions. When multiple are passed, the relationship is AND.
conditions.fieldNameNostringNoneName of the query condition, e.g., realName
conditions.fieldValueNostringNoneValue of the query condition
conditions.conditionalTypeNonumber0Comparison type: 0: exact match, 1: fuzzy match, 2: greater than, 3: greater than or equal, 4: less than, 5: less than or equal, 6: in, 7: not in, 8: left fuzzy match, 9: right fuzzy match, 10: not equal, 11: nullOrEmpty, 12: not empty, 13: notLike
pageIndexYesnumberNonePage number
pageSizeYesnumberNoneNumber per page
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/pageList' \
--header 'Authorization: openapi {access_token}' \
{
"orderField": "id",
"orderType": "desc",
"conditions": [
{
"fieldName": "realName",
"fieldValue": "张三",
"conditionalType": 0
}
],
"pageIndex": 1,
"pageSize": 15
}
  • Response body:
Field NameTypeDescription
dataarrayPaginated data
data.idstringAccount ID
data.userIdstringUser ID
data.userNamestringUsername
data.activebooleanWhether activated
data.avatarstringAvatar
data.birthdaystringBirthday
data.createdstringUser data creation date
data.modifiedstringUser data last modified date
data.descriptionstringDescription
data.gendernumberGender 0:FEMALE, 1:MALE
data.mobilePhonestringMobile phone number
data.nickNamestringNickname
data.emailstringEmail
data.joinTimestringDate of joining
data.regionstringRegion
data.weChatstringWeChat ID
data.spellstringPinyin of real name
data.serialNumberstringEmployee number
data.accountIdstringAccount ID to which the user belongs
data.sortnumberSort number
data.officePhoneNumberstringOffice phone number
data.externalbooleanInternal/external user flag false: internal user, true: external user
data.isAadbooleanWhether the account comes from AAD (Microsoft Entra ID)
data.enablebooleanEnable/Disable
pageIndexnumberCurrent page number
pageSizenumberPage size
totalCountnumberTotal count
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"data": [
{
"accountId": "123456",
"userId": "123456",
"userName": "user1",
"realName": "张三"
}
],
"pageSize": 15,
"pageIndex": 1,
"totalCount": 1,
"success": true,
"msg": null
}

Get User Information

  • Endpoint: v1/openapi/user/{userCode}

  • HTTP Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Route parameters:
Parameter NameRequiredTypeDefaultDescription
userCodeYesstringNoneUser ID or username
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/123456' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataobjectResponse data object
data.idstringAccount ID
data.userIdstringUser ID
data.userNamestringUsername
data.ActivebooleanWhether activated
data.AvatarstringAvatar
data.BirthdaystringBirthday
data.CreatedstringUser data creation date
data.ModifiedstringUser data last modified date
data.DescriptionstringDescription
data.GendernumberGender 0:FEMALE, 1:MALE
data.MobilePhonestringMobile phone number
data.NickNamestringNickname
data.EmailstringEmail
data.JoinTimestringDate of joining
data.RegionstringRegion
data.WeChatstringWeChat ID
data.SpellstringPinyin of real name
data.SerialNumberstringEmployee number
data.AccountIdstringAccount ID to which the user belongs
data.SortnumberSort number
data.OfficePhoneNumberstringOffice phone number
data.ExternalbooleanInternal/external user flag false: internal user, true: external user
data.IsAadbooleanWhether the account comes from AAD (Microsoft Entra ID)
data.EnablebooleanEnable/Disable
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:

json
{
"success": true,
"msg": "",
"data": [
{
"accountId": "123456",
"userId": "123456",
"userName": "user1",
"realName": "张三"
}
]
}

Get Current Logged-in User Information

  • API Endpoint: v1/openapi/user/me

  • Request Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json

  • Request Example:

curl --location 'http://localhost/v1/openapi/user/me' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataobjectResponse data object
data.idstringAccount ID
data.userIdstringUser ID
data.userNamestringUsername
data.ActivebooleanWhether activated
data.AvatarstringAvatar
data.BirthdaystringBirthday
data.CreatedstringUser data creation date
data.ModifiedstringUser data last modified date
data.DescriptionstringDescription
data.GendernumberGender 0:FEMALE, 1:MALE
data.MobilePhonestringMobile phone number
data.NickNamestringNickname
data.EmailstringEmail
data.JoinTimestringDate of joining
data.RegionstringRegion
data.WeChatstringWeChat ID
data.SpellstringPinyin of real name
data.SerialNumberstringEmployee number
data.AccountIdstringAccount ID the user belongs to
data.SortnumberSort number
data.OfficePhoneNumberstringOffice phone number
data.ExternalbooleanInternal/external user flag false: internal user, true: external user
data.IsAadbooleanWhether account is from AAD (Microsoft Entra ID)
data.EnablebooleanEnable/Disable
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"accountId": "123456",
"userId": "123456",
"userName": "user1",
"realName": "张三"
}
]
}

Get Current Logged-in User Roles

  • API Endpoint: v1/openapi/user/roles

  • Request Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json

  • Request Example:

curl --location 'http://localhost/v1/openapi/user/me/roles' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataarrayResponse data object
data.roleIdstringRole ID
data.roleNamestringRole name
data.dataPermissionListarrayData permissions for the user under this role
data.dataPermissionList.BusinessTreeTypenumberApplication type
data.dataPermissionList.DataPermissionObjectIdstringData permission object ID, e.g., if it's knowledge base permission, it's the knowledge base ID
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"roleId": "123456",
"roleName": "知识库访客",
"dataPermissionList": [
{
"BusinessTreeType": 1,
"DataPermissionObjectId": "123456"
}
]
}
]
}

Get Roles Associated with a User

  • API Endpoint: v1/openapi/user/{userCode}/roles

  • Request Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json
  • Route Parameters:
Parameter NameRequiredTypeDefaultDescription
userCodeYesstringNoneUser ID array or username
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/123456/roles' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataarrayResponse data object
data.roleIdstringRole ID
data.roleNamestringRole name
data.dataPermissionListarrayData permissions for the user under this role
data.dataPermissionList.BusinessTreeTypenumberApplication type
data.dataPermissionList.DataPermissionObjectIdstringData permission object ID, e.g., if it's knowledge base permission, it's the knowledge base ID
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"roleId": "123456",
"roleName": "知识库访客",
"dataPermissionList": [
{
"BusinessTreeType": 1,
"DataPermissionObjectId": "123456"
}
]
}
]
}

Modify User-Role Relationship

  • API Endpoint: v1/openapi/user/{userCode}/roles

  • Request Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json
  • Route Parameters:
Parameter NameRequiredTypeDefaultDescription
userCodeYesstringNoneUser ID array or username
  • Request body:
Parameter NameRequiredTypeDefaultDescription
YesarrayNoneArray of role IDs or role names. The array must contain either all IDs or all names.
  • Request Example:
curl --location 'http://localhost/v1/openapi/user/123456/roles' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataarrayResponse data object
data.roleIdstringRole ID
data.roleNamestringRole name
data.dataPermissionListarrayData permissions for the user under this role
data.dataPermissionList.BusinessTreeTypenumberApplication type
data.dataPermissionList.DataPermissionObjectIdstringData permission object ID, e.g., if it's knowledge base permission, it's the knowledge base ID
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"roleId": "123456",
"roleName": "知识库访客",
"dataPermissionList": [
{
"BusinessTreeType": 1,
"DataPermissionObjectId": "123456"
}
]
}
]
}

Organization

Add Organization

  • API Endpoint: v1/openapi/organization

  • Request Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
codeYesstringNoneOrganization code, unique in the system, cannot be duplicated
parentIdNostringNoneAt least one of parent organization ID or parent organization name must be filled
parentNameNostringNoneParent organization name, at least one of parent organization ID or name must be filled
nameYesstringNoneName
locationNostringNoneAddress
remarksNostringNoneRemarks
contactNostringNoneContact information
InfoNostringNoneOrganization information
ExtensionNostringNoneExtension information
IsSubsidiaryNobooleanfalseWhether it is a subsidiary
sortNonumber0Sort number
isEnableNobooleanfalseEnable/Disable
externalNobooleanfalseInternal/external organization flag false: internal, true: external
  • Request Example:
curl --location 'http://localhost/v1/openapi/organization' \
--header 'Authorization: openapi {access_token}' \
--data '{
"code": "123456",
"parentId": "12345",
"name": "组织名称",
"location": "地址"
} '
  • Response body:
Field NameTypeDescription
dataobjectResponse data object
data.idstringOrganization ID
data.codestringOrganization code
data.parentIdstringParent organization ID
data.parentNamestringWhether activated
data.namestringName
data.locationstringAddress
data.remarksstringRemarks
data.contactstringContact information
data.InfostringOrganization information
data.ExtensionnumberExtension information
data.IsSubsidiarybooleanWhether it is a subsidiary
data.sortnumberSort number
data.isEnablebooleanEnable/Disable
data.externalbooleanInternal/external organization flag
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response Example:
{
"success": true,
"msg": "",
"data": [
{
"id": "123456",
"code": "123456",
"parentId": "12345",
"name": "组织名称",
"location": "地址"
}
]
}

Update Organization

  • API Endpoint: v1/openapi/organization

  • Request Method: put

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, value format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
idNostringNoneOrganization ID, at least one of id or code must be filled
codeNostringNoneOrganization code, at least one of id or code must be filled
parentIdNostringNoneAt least one of parent organization ID or parent organization name must be filled
parentNameNostringNoneParent organization name, at least one of parent organization ID or name must be filled
nameYesstringNoneName
locationNostringNoneAddress
remarksNostringNoneRemarks
contactNostringNoneContact information
InfoNostringNoneOrganization information
ExtensionNostringNoneExtension information
IsSubsidiaryNobooleanfalseWhether it is a subsidiary
sortNonumber0Sort number
isEnableNobooleanfalseEnable/Disable
externalNobooleanfalseInternal/external organization flag false: internal, true: external
  • Request Example:

shell
curl --location 'http://localhost/v1/openapi/organization' \
--header 'Authorization: openapi {access_token}' \
--data '{
"code": "123456",
"parentId": "12345",
"name": "Organization Name",
"location": "Address"
} '
  • Response body:
Field NameTypeDescription
dataobjectResponse data object
data.idstringOrganization ID
data.codestringOrganization code
data.parentIdstringParent organization ID
data.parentNamestringIs activated
data.namestringName
data.locationstringAddress
data.remarksstringRemarks
data.contactstringContact information
data.InfostringOrganization information
data.ExtensionnumberExtension information
data.IsSubsidiarybooleanIs subsidiary
data.sortnumberSort number
data.isEnablebooleanEnable/Disable
data.externalbooleanInternal/External organization flag
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"success": true,
"msg": "",
"data": [
{
"id": "123456",
"code": "123456",
"parentId": "12345",
"name": "Organization Name",
"location": "Address"
}
]
}

Delete Organization

  • Endpoint: v1/openapi/organization

  • HTTP Method: delete

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
YesarrayNoneArray of organization IDs or organization names. The array must contain either all IDs or all names.
  • Request example:
curl --location 'http://localhost/v1/openapi/organization' \
--header 'Authorization: openapi {access_token}' \
--data '['org1','org2']'
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"success": true,
"msg": ""
}

Get Tree Organization Structure

  • Endpoint: v1/openapi/organization/tree

  • HTTP Method: get

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request query:
Parameter NameRequiredTypeDefaultDescription
externalNobooleanfalseWhether external organization
  • Request example:
curl --location 'http://localhost/v1/openapi/organization/tree' \
--header 'Authorization: openapi {access_token}' \
  • Response body:
Field NameTypeDescription
dataarrayResponse data object
data.nodeIdstringOrganization ID
data.nodeNamestringOrganization name
data.parentNodeIdstringParent organization ID
data.codestringOrganization code
data.pathstringPath from root node to current node -- IDs separated by '/'
data.externalbooleanInternal/External organization flag
data.childNodeListarrayChild organizations
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"success": true,
"msg": "",
"data": [
{
"isExternal": false,
"sort": 1,
"nodeId": "4034994050380595200",
"nodeName": "Internal Organization",
"path": "4034994050380595200/4419926899526991872",
"parentNodeId": "-1",
"childNodeList": [
{
"isExternal": false,
"sort": 1,
"nodeId": "4419926899526991872",
"nodeName": "IT",
"path": "4034994050380595200/4419926899526991872",
"parentNodeId": "4034994050380595200",
}
]
}
]
}

Get Users by Organization Relationship (Paginated)

  • Endpoint: v1/openapi/organization/getAllOrgUserPageList

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
orderFieldYesstringNoneField for sorting. ID contains time info, so sorting by ID can be used as creation time sorting
orderTypeYesstringNoneSort type, asc: ascending, desc: descending
conditionsNoarrayNoneQuery conditions, multiple conditions are combined with AND
conditions.fieldNameNostringNoneName of the query condition, e.g. organizationId
conditions.fieldValueNostringNoneValue of the query condition
conditions.conditionalTypeNonumber0Comparison type: 0: exact match, 1: fuzzy match, 2: greater than, 3: greater or equal, 4: less than, 5: less or equal, 6: in, 7: not in, 8: left fuzzy match, 9: right fuzzy match, 10: not equal, 11: nullOrEmpty, 12: not empty, 13: notLike
pageIndexYesnumberNonePage number
pageSizeYesnumberNoneNumber per page
  • Request example:
curl --location 'http://localhost/v1/openapi/organization/getAllOrgUserPageList' \
--header 'Authorization: openapi {access_token}' \
{
"orderField": "id",
"orderType": "desc",
"conditions": [
{
"fieldName": "organizationName",
"fieldValue": "123456",
"conditionalType": 0
}
],
"pageIndex": 1,
"pageSize": 15
}
  • Response body:
Field NameTypeDescription
dataarrayPaginated data
data.userIdstringUser ID
data.accountstringUsername
data.accountIdbooleanAccount ID
data.realNamestringReal name
data.organizationNamestringOrganization name
data.organizationIdstringOrganization ID
data.organizationParentIdstringParent organization ID
data.EmailstringEmail
data.SortnumberSort number
data.ExternalbooleanInternal/External user flag false: internal user, true: external user
pageIndexnumberCurrent page number
pageSizenumberPage size
totalCountnumberTotal count
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"data": [
{
"account": "user1",
"accountId": "123456",
"userId": "123456",
"realName": "user1",
"organizationName": "org1",
"organizationId": "123456",
"external": false,
"organizationParentId": "12345",
"sort": 1,
"email": ""
}
],
"pageSize": 15,
"pageIndex": 1,
"totalCount": 1,
"success": true,
"msg": null
}

Add User-Organization Relationship

  • Endpoint: v1/openapi/organization/relationship

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
organizationIdYesstringNoneOrganization ID
userIdYesstringNoneUser ID
sortNonumber0Sort number
  • Request example:
curl --location 'http://localhost/v1/openapi/organization/relationship' \
--header 'Authorization: openapi {access_token}' \
--data '{
"organizationId": "123456",
"userId": "12345"
} '
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"success": true,
"msg": ""
}

Delete User-Organization Relationship

  • Endpoint: v1/openapi/organization/relationship

  • HTTP Method: delete

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
organizationIdsYesarrayNoneOrganization IDs
userIdsYesarrayNoneUser IDs
  • Request example:
curl --location 'http://localhost/v1/openapi/organization/relationship' \
--header 'Authorization: openapi {access_token}' \
--data '{
"organizationIds": ["123456"],
"userIds": ["12345"]
} '
  • Response body:
Field NameTypeDescription
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"success": true,
"msg": ""
}

Query Users under Organization (Paginated)

  • Endpoint: v1/openapi/organization/getUserPages

  • HTTP Method: post

  • Request header:

Parameter NameRequiredTypeDescription
AuthorizationYesstringFill in SERVICEME access token, format: openapi {access_token}
  • Content Type: application/json
  • Request body:
Parameter NameRequiredTypeDefaultDescription
orderFieldYesstringNoneField for sorting. ID contains time info, so sorting by ID can be used as creation time sorting
orderTypeYesstringNoneSort type, asc: ascending, desc: descending
conditionsNoarrayNoneQuery conditions, multiple conditions are combined with AND
conditions.fieldNameNostringNoneName of the query condition, must provide at least OrganizationId or OrganizationCode as filter condition
conditions.fieldValueNostringNoneValue of the query condition
conditions.conditionalTypeNonumber0Comparison type: 0: exact match, 1: fuzzy match, 2: greater than, 3: greater or equal, 4: less than, 5: less or equal, 6: in, 7: not in, 8: left fuzzy match, 9: right fuzzy match, 10: not equal, 11: nullOrEmpty, 12: not empty, 13: notLike
pageIndexYesnumberNonePage number
pageSizeYesnumberNoneNumber per page
  • Request example:

shell
curl --location 'http://localhost/v1/openapi/user/pageList' \
--header 'Authorization: openapi {access_token}' \
{
"orderField": "id",
"orderType": "desc",
"conditions": [
{
"fieldName": "OrganizationCode",
"fieldValue": "org1",
"conditionalType": 0
}
],
"pageIndex": 1,
"pageSize": 15
}
  • Response body:
Field NameTypeDescription
dataarrayPaginated data
data.idstringUser ID
data.accountstringUsername
data.namestringReal name
data.ownerMainDepartmentstringUser's main department
data.sortnumberSort number
data.statusbooleanUser enabled status
data.createdatetimeUser creation time
pageIndexnumberCurrent page number
pageSizenumberPage size
totalCountnumberTotal count
successbooleanWhether the request was successful
msgstringMessage returned by the request (if any)
  • Response example:
{
"data": [
{
"accountId": "123456",
"userId": "123456",
"userName": "user1",
"realName": "张三"
}
],
"pageSize": 15,
"pageIndex": 1,
"totalCount": 1,
"success": true,
"msg": null
}