callProcedure Error Handling

This topic describes the error messages and error codes returned by the callProcedure method.

Examples of Error Messages
{
    "apiVersion": 1,
    "method": "error",
    "callId": "123abc",
    "errors": [
        {
            "type": "TYPE_PROCEDURE_ERROR",
            "code": "CODE_PROCEDURE_UNKNOWN"
        }
    ]
 
}
{
    "apiVersion": 1,
    "callId": "KnnXUxS7APzLBVIzY+8B0g==",
    "method": "error",
    "errors": [
        {
            "type": "TYPE_PROCEDURE_PARAM_ITEM",
            "code": "CODE_PROCEDURE_PARAM_ITEM_MANDATORY_FIELD_EMPTY",
            "procedure": "getParts",
            "paramName": "items",
            "itemId": 2,
            "itemField": "label"
        }
    ]
}
Example Error Message for share Procedure
[
    {
        "type": "TYPE_PROCEDURE_PARAM",
        "code": "CODE_PROCEDURE_MANDATORY_PARAM_EMPTY",
        "procedure": "share",
        "paramName": "fileObject"
    }
]

Types of Error Messages

The error message contains only errors of these types:
Type Occurs When Available Message Fields
TYPE_PROCEDURE_ERROR Procedure call is not valid due to missed parameters, and procedure is run with errors.
  • procedure: Name of procedure on which the error has occurred.

  • callId (if available): Id of the procedure call that has caused the error. This is same as the callId param of callProcedure method received.

TYPE_PROCEDURE_PARAM Invalid or missed procedure parameters.
  • procedure: Name of procedure on which the error has occurred.

    callId: Id of the procedure call that has caused the error. This is same as the callId param of callProcedure method received.

TYPE_PROCEDURE_GET_ACCESS_TOKEN_ERROR Procedure is called with issue in Access Token that is absent in Plugin's configuration.
  • procedure: Name of procedure on which the error has occurred.

    callId: Id of the procedure call that has caused the error. This is same as the callId param of callProcedure method received.

Error Codes
The error codes generated by callProcedure are as follows:
Code Error Type Cause
TYPE_PROCEDURE_ERROR
CODE_CALL_ID_EMPTY Validation error Empty callId param.
CODE_CALL_ID_INVALID Validation error Invalid callId param.
CODE_CALL_ID_DUPLICATE Validation error Duplicate callId param.
CODE_PROCEDURE_FAILED Run error Running of procedure failed due to various reasons.
CODE_PROCEDURE_UNKNOWN Run error Procedure was called with unknown procedure name.
CODE_PROCEDURE_UNAVAILABLE Internal error Oracle Field Service Core Application service related to procedure is not available.
CODE_PROCEDURE_ACCEPTS_NO_PARAMS Validation error Procedure was called with params.
CODE_PROCEDURE_DEMAND_AT_LEAST_ONE_PARAM Validation error The params field of the callProcedure message is empty or is not an object.
CODE_PROCEDURE_MANDATORY_PARAM_EMPTY Validation error One of these:
  • iconData param of updateIconData procedure is not sent or is empty.
  • buttonsIconData param of updateButtonsIconData procedure is not set.
CODE_PROCEDURE_PARAM_VALUE_INVALID Validation error The buttonsIconData param of the updateButtonsIconData procedure is not an object or is empty.
TYPE_PROCEDURE_PARAM
CODE_PROCEDURE_MANDATORY_PARAM_EMPTY Validation error Mandatory param is missed.
CODE_PROCEDURE_PARAM_VALUE_INVALID Validation error Param value is not valid.
CODE_PRINT_UNSUPPORTED_PRINT_FILE_TYPE Validation error Uploaded file type is not allowed.
CODE_PRINT_ATTACHED_FILE_IS_TOO_LARGE Validation error Uploaded file size is more then 50MB
CODE_PRINT_TYPE_AND_PRINT_FILE_FORMAT_NOT_MATCHED Validation error documentType and fileObject.type do not match.
CODE_PRINT_BROWSER_DOES_NOT_SUPPORT_PDF_VIEW Validation error The browser's built-in PDF Viewer is unavallible.
CODE_SHARE_ATTACHED_FILE_IS_TOO_LARGE Validation error Uploaded file size is more then 50 MB.
CODE_SHARE_TEXT_FIELD_IS_TOO_LARGE Validation error The 'text' field can not be larger than 52 428 800 symbols, which equals to 50 MB (51200 kb) file size when saved as text in UTF-8.
CODE_SHARE_INVALID_SHARE_FILE Validation error Error reading the file, if the file is not a file or is not a blob.
TYPE_PROCEDURE_PARAM_ITEM
CODE_PROCEDURE_PARAM_ITEM_MANDATORY_FIELD_EMPTY Validation error Mandatory field of the item is missing.
CODE_PROCEDURE_PARAM_ITEM_MANDATORY_PARAM_EMPTY Validation error One of required fields is empty
CODE_PROCEDURE_PARAM_ITEM_FIELD_INVALID Validation error Value of item field is not valid.
TYPE_WAKEUP_PARAM
CODE_WAKEUP_EVENTS_INVALID Validation error wakeOnEvents is not a plain object.
CODE_WAKEUP_EVENT_NOT_SUPPORTED Validation error wakeOnEvents contains a field, whose key is not online or timer.
CODE_WAKEUP_EVENT_PARAMS_INVALID Validation error wakeOnEvents contains a field which in not null and is not a plain object.
CODE_WAKEUP_EVENT_PARAM_VALUE_INVALID Validation error One of these:
  • Value of wakeupDelay is not an integer number.
  • Value of wakeupDelay is less than 10.
  • Value of sleepTimeout is not an integer number.
  • Value of sleepTimeout is less than 10 or greater than 3600.
TYPE_INTERNAL
CODE_UNKNOWN Validation error Check JSON syntax and method that is sent
CODE_JSON_INVALID
CODE_METHOD_NOT_SUPPORTED
TYPE_PROCEDURE_GET_ACCESS_TOKEN_ERROR
CODE_GET_ACCESS_TOKEN_WRONG_APPLICATION_KEY Validation error Do not call the procedure with an application differ from the applications that were received in init method
CODE_GET_ACCESS_TOKEN_APPLICATION_NOT_CONFIGURED Validation error Choose an Application on Plugin Configuration Screen
CODE_GET_ACCESS_TOKEN_OFFLINE_NOT_SUPPORTED Validation error Run procedure when the device is online
CODE_GET_ACCESS_TOKEN_PROCEDURE_TIMEOUT Validation error Usually such long timeout caused problems with internet connection or problems of Authorization server. Normally it should respond in <4 sec.
CODE_PROCEDURE_FAILED App misconfigured

Choose an Application on Plugin Configuration Screen

Activate an OFS Application

Unexpected response Check that Auth Server URL is correct.

Example: Fusion Token URL is set without suffix "/oauth2/v1/token"

Cannot infer used id The field of user should be filled.
Token service error - invalid request Check the scope field is not empty, in case of Fusion it is mandatory.
Token service error - invalid client

Activate an IDCS Application

Check that Client ID / Client Secret is correct

Token service error - invalid grant Check that certificate is valid
Token service error - unauthorized client Check that client has authorization to use the requested grant.
Token service error - unsupported grant type Check is Authorization server supports grant_type: client_credentials or urn:ietf:params:oauth:grant-type:jwt-bearer
Token service error - invalid scope Check the scope value
Connection error Check that Auth Server URL is correct.
Internal Error Exceptional case. Contact Administrator.
Access denied Exceptional case. Contact Administrator.

Provide Key and Comments of required API to plugin Configurator

Developer can prepare an XML file of a plugin where they can specify the Key and Comment of the application which is required for Plugin to request API. So, once a configurator imports the plugin XML, they can see the ‘Applications’ section on the Plugin Edit screen with applications that should be assigned to a plugin to provide access to the required API.
  • Key could be hardcoded in the Plugin's code. Configurator will choose some application from the list that will be used for it.

  • Comment is used to give to Configurator more details which application should be chosen.

Example of Plugin Applications in import.xml file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<format version="1"/>
<product version="24.4.0"/>
<plugins>
<plugin label="hosted" action_label="" action_entity="" action_type="addon_action" type="addon">
 <translations>
  <translation lang="en" val="hosted"/>
 </translations>
 <fields>
  <field label="atype" entity="activity"/>
  <field label="aworktype" entity="activity"/>
  <field label="astatus" entity="activity"/>
 </fields>
 <plugin_applications>
  <plugin_application name="EXT" type="oauth_client_credentials" key="external_api" comment=“API to update work orders in CRM"/>
  <plugin_application name="FUSION" type="oauth_user_assertion" key="employees_api" comment=“API to get statuses of ordered parts"/>
  <plugin_application name="OFS" type="ofs" key="activity_api" comment=“API to get a list of user’s activities"/>
 </plugin_applications>
 <plugin_data>
  <plugin_data_item path="" post_data="" width="" height="" options="32" user_agent_mask="" sort_order="0" native_app_label="" auth_type="" auth_login="">
   <hosted_plugin_data name="hosted" content_hash="...">
    <content><![CDATA[...]]></content>
   </hosted_plugin_data>
  </plugin_data_item>
 </plugin_data>
</plugin>
</plugins>
</root>