Introduction

Service commands are used to manage the agent, receive logs, update, etc. These commands

  • Created based on user actions in the White Server administrative panel or by the White Server task scheduler
  • Have the same structure as requests from the aggregator to the agent
  • They are displayed in the White Server administrative panel in the same way as tasks from aggregators.

The agent sends a GetTask method request via RPC (remote procedure call) and receives a service task in response. After preparing the answer, the agent sends it via RPC using AnswerTask.

Example of interaction:

  1. The aggregator sent a CancelOrder request
  2. The agent will retrieve the params data array from this request via the GetTask operation
  3. The agent will return the response via the AnswerTask
  4. From AnswerTask, the contents of the taskResponse array will go to the aggregator in an asynchronous response, to the taskResponse data array as well.

RPC

RPC is a remote procedure call. A common url is used for sending requests for agents and monitors — https://{{serverName}}/wsagent/api/v2/agents/rpc

RPC Request Structure

The structure of requests from agents and monitors is the same, as are the server responses.

Request format


JSON

{
   "rpcTaskType":"string",
   "params":{
   }
}

Parameter

Type

Mandatory

Description

taskTypestringyesTask type. It can be 
  • GetTask — get a task
  • AnswerTask — return the answer to the task.
params
noPayload data array. Corresponds to the params request model for the aggregator.

Successful response:

JSON

{
  "result": {
   }
}


Response with error
JSON

{
 "error": {
  /// error details   
  }
}

GetTask

GetTask — task receiving type. 

Parameter

Type

Mandatory

Description

Parameter

Type

Mandatory

Description

-taskGuidguidyesUnique code for this task. Used when receiving a task via the queue
-taskTypestring enumyesTask type
-objectIdintno

Restaurant code in the licensing system:

  • Mandatory for tasks from external aggregators to the restaurant's objectId, for example, for CreateOrder
  • Optional for system tasks to the agent, such as ServiceGetAgentSettings.
-pluggedSystemIdstringnoThe identifier of the system being plugged in, such as the NetName of the r_keeper server. Taken from the pluggedSystems:systemName field in the response to the GetAgentInfo model
-timeoutintnoAgent response time in seconds
-aggregatorIdintnoThe code of the aggregator in the licensing system that created the task
-paramsjson objectnoThe data array corresponds to the params request model for the aggregator

AnswerTask

AnswerTask — the type of task that returns the answer.

JSON

{
   "rpcTaskType":"AnswerTask",
   "params":{
      "taskGuid":"guid",
      "taskResponse":{
      }
   }
}
CODE



{
    "rpcTaskType": "AnswerTask"
}
CODE

JSON

 {
  "result": {
   }
}
CODE


JSON

{
  "error": {
    "wsError": {
      "code": "string",
      "text": "string"
    }
  }
}
CODE