English
Fx.org
About 999 wordsAbout 3 min
2026-01-09
Table of Contents
Summary
The overview of this document is as follows: This document introduces the API definitions of Fx.organization, usage methods, and related notes.
1. findUserById Query user information by user ID
Fx.org.findUserById(<String userId>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| userId | String | User ID | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| 1001 | Map | APIResult |
| 1001 | Map | APIResult |
|---|---|---|
| package | string |
Return an example
{
"1001": {
"package": "CRM"
}
}Code examples
def(Boolean error, Map data, String errorMessage) = Fx.org.findUserById("1001")
if (error) {
log.error("Failed to fetch object: " + errorMessage)
//1. Terminate execution by throwing exception
//Fx.message.throwException("Failed to fetch object: "+errorMessage)
//2. Terminate execution using return
//return;
//3. Continue execution
}
//dosomethingNotice
- Parameter cannot be empty
2. findByUserIds Query user information by a list of user IDs
Query user information by user ID list
Fx.org.findByUserIds(<String userIds>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| userIds | String | List of user IDs | Y |
Return Parameters
| Parameter Name | APIResult | JSON Schema for API response |
|---|---|---|
| isError | boolean | Indicates whether an error occurred |
| data | Map | Response data |
| message | string | Message information |
Return an example
{
"isError" : false,
"data" : {},
"message" : ""
}Code examples
def (Boolean error, Map data, String errorMessage) = Fx.org.findByUserIds(["1001","1002"])
if (error) {
log.error("Failed to retrieve objects: " + errorMessage)
//1. Terminate execution by throwing an exception
//Fx.message.throwException("Failed to retrieve objects: " + errorMessage)
//2. Terminate execution using return
//return;
//3. Continue execution
}
//dosomething3. findEmployeeByDepartmentId Query employee information by department ID
Retrieve employee information by department ID
Fx.org.findEmployeeByDepartmentId(<String id>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| id | String | Department ID | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| departmentId | String | Department ID |
| name | String | Department name |
| tenantId | String | Enterprise ID |
| ViceDepartmentIds | List | Affiliated departments |
| employee | String | Employee ID |
| type | integer | 1: Internal employee 2: External employee |
| status | integer | Department status 1: Active 2: Disabled 3: Deleted |
Return an example
[{"departmentId":"1000","name":"Yang Zi","tenantId":"85154","ViceDepartmentIds":[],"employee":"1002","type":1,"status":1}]Code examples
def (Boolean error, List data, String errorMessage) = Fx.org.findEmployeeByDepartmentId('1061')Notice
- Return data type: List
- String departmentId: Primary department ID
- String name: Department name
- String tenantId: Enterprise ID
- List ViceDepartmentIds: Affiliated department IDs
- String employee: Employee ID
- Integer type: Employee type (1: Internal employee, 2: External employee)
- Integer status: Department status (1: Active, 2: Inactive, 3: Deleted)
4. findDepartmentByIds Query department information based on a list of department IDs
Retrieve department information based on a list of department IDs
Fx.org.findDepartmentByIds(<List id>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| id | List[string] | Department IDs | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| owner | List[string] | Responsible person(s) |
| superordinateDepartmentId | String | Parent department ID |
| departmentId | String | Department ID |
| name | String | Department name |
| enterpriseId | String | Enterprise ID |
Return an example
{"owner":["1000"],"superordinateDepartmentId":"1038","departmentId":"1001","name":"Star Department 0866111112","enterpriseId":"85154"}Code examples
def (Boolean error, List data, String errorMessage) = Fx.org.findDepartmentByIds(['1016'])Notice
- Since downstream enterprises are treated as departments within the organizational structure of upstream enterprises, this function can also be used to query the contacts of downstream enterprises. In this case, the owner represents the contact person of the downstream enterprise.
5. findSuperordinateDepartments Query superior department information by department ID
Retrieve parent department information by department ID
Fx.org.findSuperordinateDepartments(<String id>, <Boolean recursion>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| id | String | Department ID | Y |
| recursion | Boolean | Whether to recurse | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| owner | List[string] | Responsible person(s) |
| superordinateDepartmentId | String | Parent department ID |
| departmentId | String | Department ID |
| name | String | Department name |
| enterpriseId | String | Enterprise ID |
Return an example
{"1001":{"owner":["1000"],"superordinateDepartmentId":"1038","departmentId":"1001","name":"Star Department 0866111112","enterpriseId":"85154"}}Code examples
def (Boolean error, Map data, String errorMessage) = Fx.org.findSuperordinateDepartments('1016', true)6. findSubordinateDepartments Query subordinate department information by department ID
Retrieve subordinate department information by department ID
Fx.org.findSubordinateDepartments(<String id>, <Boolean recursion>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| id | String | Department ID | Y |
| recursion | Boolean | Whether to enable recursion | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| owner | List[string] | Responsible person(s) |
| superordinateDepartmentId | String | Parent department ID |
| departmentId | String | Department ID |
| name | String | Department name |
| enterpriseId | String | Enterprise ID |
Return an example
{"1001":{"owner":["1000"],"superordinateDepartmentId":"1038","departmentId":"1001","name":"Star Department 0866111112","enterpriseId":"85154"}}Code examples
def (Boolean error, Map data, String errorMessage) = Fx.org.findSubordinateDepartments('1016', true)Notice
- Depending on the recursion parameter to determine whether to recurse
7. findOutUserById Query External User Information
Query External Personnel Information
Fx.org.findOutUserById()
Code examples
def (boolean error, Map result, String errorMessage) = Fx.org.findOutUserById("300090724")Owner:尚壬鹏ShawnRennPenn
8. findOutUserByIds Batch Query External User Information
Batch Query External Personnel Information
Fx.org.findOutUserByIds()
Code examples
def (boolean error, Map result, String errorMessage) = Fx.org.findOutUserByIds(["300090724"])Notice
- Query external personnel information.
Owner:尚壬鹏ShawnRennPenn
9. getCompanyInfo Get Company Information
Obtain Enterprise Information
Fx.org.getCompanyInfo()
Request parameters
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| tenantType | String | Tenant type |
| defaultLanguage | String | Default language |
| defaultTimeZone | String | Default time zone |
| companyName | String | Company name |
| tenantId | String | Tenant ID |
| isSandbox | String | Whether it is a sandbox tenant |
Return an example
{
"tenantType": "enterprise_edition",
"defaultLanguage": "zh-CN",
"defaultTimeZone": "Asia/Shanghai",
"companyName": "Java Function Development Specialized",
"tenantId": "83740",
"isSandbox": false
}Code examples
def (boolean error, Map result, String errorMessage) = Fx.org.getCompanyInfo()Changelog
| Version | Date | Changes | Author |
|---|---|---|---|
| v1.0 | 2026-05-20 | Initial version |
Background
This document provides detailed information about the Fx.org API functionality and usage, helping developers integrate relevant capabilities.
Applicable Scenarios
Specific applicable scenarios are determined by actual business needs. Developers can select the appropriate API for integration as required.
Prerequisites
- Access to Fxiaoke Open Platform
- Application authorization and configuration completed
- Basic knowledge of relevant business domain
Steps
Please refer to the detailed instructions for each API.
Notes
- Ensure prerequisites are met before calling APIs
- Pay attention to API call frequency limits
- Refer to error code documentation for exception handling
Compatibility note: This version currently has no deprecated or compatibility notes.
