7 Users and Organization Structure RESTFUL Interface

This document provide the information on how to get users and organizational structures list. RESTFul API document explanations.

1 Explanation

  • The submitted parameters are in the data format of key-value pairs (application/x-www-form-urlencoded), and web browsers will package this data and populate into the http body.

  • Authentication Method (/hrm/websevice/hrm_webservice_config.jsp will provide authentication methods configurations)

    • IP Address: Allow to configure multiple client IP in /WEB-INF/prop/HrmWebserviceIP.properties, separate by comma.

    • Token Authentications: Extra parameter in submitted parameters

Name
Type
Mandatory
Description

token

string

Yes

json string, each token has 5 minutes validity period (the request-side time and the server-side time principle are consistent), suggest to generate new token for every request.

  • Example:

{
	"key":"92B4BF9322C110E225683F048013B699", //Token+Timestamp milliseconds, then use MD5/SM3 to encrypt to generate as key
	"ts":"1603600893041" // Timestamp milliseconds.
}
  • key generate methods, java sample:

public static void main(String[] args) throws Exception{
	String key = "5936562a-d47c-4a29-9b74-b310e6c971b7" ; //retrieve index method, please browse /hrm/websevice/hrm_webservice_config.jsp
	long l = System.currentTimeMillis() ; // Timestamp milliseconds
	String code = key.concat(Long.toString(l)) ;
	String md5key = Util.getEncrypt(code).toUpperCase() ; //MD5 Encryption and change to UPPERCASE
	Map<String,String> map = new HashMap<>() ;
	map.put("key",md5key) ;
	map.put("ts",Long.toString(l)) ;
	System.out.println(JSONObject.toJSONString(map)); //Token string
}
  • Sample: There are two methods to configure the token, select either one

    • Token Method 1: Use the header method, insert key, ts parameters.

    • Token Method 2: Insert the parameters in the body:

2 Get Divisions List

Request URL

  • /api/hrm/resful/getHrmsubcompanyWithPage

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

params

string

Yes

json format data

  • Request Parameter - Sample:

Name
Type
Mandatory
Description

subcompanyname

string

Division Name

subcompanycode

string

Division Code

modified

string

modified timestamp; (use >=)

canceled

string

Inactive Data indicator; Default will get active data list. 1: Inactive

custom_data

string

Specify user-defined field data list, multiple comma to be used to separate fields. Please refer to System Backend-Dashboard - Organization Authorization - User-Defined Item - Division Field Define. eg. : divisiondesc

id

string

Division id in OA Database

pagesize

int

Number of records per page, default is 20.

curpage

int

Current page, default is 1

Exnample:

jsReturn Sample:

3 Get Departments List

Request URL:

  • /api/hrm/resful/getHrmdepartmentWithPage

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

params

string

Yes

json format data

  • json Parameters Explanation:

Name
Type
Mandatory
Description

created

string

Created Timestamp; (use >=)

modified

string

Modified Timestamp; (use >=)

departmentcode

string

Department Code

departmentname

string

Department Name

subcompanyid1

string

Division ID

canceled

string

Inactive Indicator; Default query active data, 1: Inactive

id

string

Department ID in OA Database

pagesize

int

Page Size, number of records per page, default: 20

curpage

int

Current Page, default: 1

custom_data

string

Value can be retrieved from the Department user defined field in OA system. Sample : custom_data: 'field1, field2, field3'

Sample

Return Sample:

4 Get Positions List

Request URL:

  • /api/hrm/resful/getJobtitleInfoWithPage

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

params

string

Yes

json format data

json Parameters Explanation:

Name
Type
Mandatory
Description

created

string

Created Timestamp; (use >=)

modified

string

Modified Timestamp; (use >=)

id

string

Position ID in OA Database

jobtitlename

string

Position Name

pagesize

int

Page Size, number of records per page, default: 20

curpage

int

Current Page, default: 1

Sample

Return Sample:

5 Get Users List

Request URL:

  • /api/hrm/resful/getHrmUserInfoWithPage

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

params

string

Yes

json format data

json Parameters Explanation:

Name
Type
Mandatory
Description

created

string

Created Timestamp; (use >=)

modified

string

Modified Timestamp; (use >=)

workcode

string

Employee Code

subcompanyid1

string

Division ID

departmentid

string

Department ID

jobtitleid

string

Position ID

id

string

User ID in OA Database, PK

loginid

string

User Login ID

base_custom_data

int

To get OA User defined field: [Organization Authorisation] - [User-Defined Settings] - [Staff card fields] - Basic Info. Sample: base_custom_data: 'field1, field2, field3'

person_custom_data

string

Same as above base_custom_data (Personal Information)

work_custom_data

string

Same as above base_custom_data (Work Information)

pagesize

int

Records per page, default: 20

curpage

int

Current page number, default: 1

Sample

Return Sample:

6 Sync Division

Explanation: During the synchronization, if the data requested does not exist in OA, the record will be created automatically.

Request URL:

  • /api/hrm/resful/synSubcompany

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

data

string

Sync Data set, json format data

Sample

Return Sample:

7 Sync Department

Explanation: During the synchronization, if the data requested does not exist in OA, the record will be created in OA automatically.

Request URL:

  • /api/hrm/resful/synDepartment

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

data

string

Sync Data set, json format data

Sample

Return Sample:

8 Sync Positions

Explanation: During the synchronization, if the data requested does not exist in OA, the record will be created automatically.

Request URL:

  • /api/hrm/resful/synJobtitle

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

data

string

Sync Data set, json format data

Sample

Return Sample:

9 Sync Users

Explanation: During the synchronization, if the data requested does not exist in OA, the record will be created automatically.

For this interface, validation is against to the workcode, if the workcode exists in the OA system, the interface will take it as update function, if the workcode does not exist in OA, will insert as a new employee.

Request URL:

  • /api/hrm/resful/synHrmresource

Request Method:

  • POST

Parameters:

Name
Type
Mandatory
Description

data

string

Sync Data set, json format data

Sample

Return Sample:

Last updated