Alipay+ DocsAlipay+ Docs

CodeIdentificationService#init

Use this API to initialize the code identification service when the system gets started. This API is used to load route configuration data and schedule the updates of route configuration.


In the initialization process, the Alipay+ server SDK tries to load route configuration data from the sources in a specific order: first from the remote server, then from the local storage, and finally from the preset configurations. Once route configurations are loaded successfully, route configurations from lower-priority sources are not read.

Request parameters

N/A

Response parameters

CodeIdentificationInitResult

Item

Type

Length

Description

Required

result

Result

/

Request result, which contains information such as status and error codes. See Result for details.

M

Result

Item

Type

Length

Description

Required

resultCode

String

16

Result code

M

resultStatus

String

/

Result status. Valid values are:

  • S: Success
  • F: Failed
  • U: Unknown

M

resultMessage

String

64

Result message that describes resultCode in detail

O

Result code

resultCode

resultStatus

resultMessage

SUCCESS

S

Success

INIT_CONFIG_IS_INVALID

F

Initial configuration is invalid.

REMOTE_CONFIG_UPDATE_FAILED

F

Remote configuration update failed.

STORAGE_CONFIG_LOAD_FAILED

F

Loading storage configuration failed.

PARAM_ILLEGAL

F

Illegal parameters exist. For example, a non-numeric input, or an invalid date.

UNKNOWN_EXCEPTION

U

The API calling failed because of unknown reasons.

Result processing logic

  • If result.resultStatus is S, initialization is successful.
  • If result.resultStatus is F or U, the application startup is blocked and the MPP can troubleshoot the issue based on result codes and logs.

Sample

copy
CodeIdentificationInitResult result = codeIdentificationService.init();
if (result.getResult().getResultStatus().equals("S")){
    // Initialization success.
} else {
    // Block the application startup and troubleshoot
}