Purpose

Creates or updates the specified procedure in the database. 
For certain restaurants, the request is forwarded to r_k Cloud. No agent is required to be connected.

LimitsOnly for the RkReports aggregator
Supported agent versionv2
PluggetSystemTypeSql

Request format


JSON

{
  "taskType": "CreateOrUpdateSqlProc",
  "params": {
    "async": {
      "objectId": number,
       "timeout": number
    },
    "sync": {
      "objectId": number,
       "timeout": number
    },
    "procName": "string",
    "procSql": "string"
  }
}

Parameter

Type

Mandatory

Description

taskTypestringyesTask type. For this method, the value is CreateOrUpdateSqlProc
-async

Asynchronous method call: either synchronous or asynchronous.

-sync

Synchronous method call: either synchronous or asynchronous
--timeoutintnoAgent response time in seconds. Default is 120 seconds
--objectIdintyesRestaurant code in the licensing system
-procNamestringyesFull name of the stored procedure
-procSqlstringyes

Full text of Sql to create a procedure that will be created in the DB. The script should start with CREATE PROCEDURE procName, where procName is equal to the value of the procName parameter

Example request


JSON

{
  "taskType": "CreateOrUpdateSqlProc",
  "params": {
    "sync": {
      "objectId": "199990001",
       "timeout": 10
    },
  
    "procName": "SuperProc_v1",
    "procSql": "CREATE PROCEDURE SuperProc_v1\n@objectId int = 0\nAS\nBEGIN\nSET NOCOUNT ON;\nSELECT @objectId, 'SuperProc_v1Created'\nEND"
  }
}



Synchronous response format


JSON

{
   "responseCommon":{
      "taskGuid":"guid",
      "taskType":"CreateOrUpdateSqlProc",
      "objectId": 0
   },
   "error":{
      "wsError":{
         "code":"string",
         "desc":"string"
      }
   }
}

Parameter

Type

Description

-taskGuidguidUnique code for this task. Used when receiving a task via the queue
-taskTypestring enumTask type
-objectIdintRestaurant code in the licensing system
error
Error container, for more details see the article Error Description

Asynchronous response format

Successful response


JSON

{
  "taskResponse": {
     "procName": "name"
     "success": true,
     }
  },
  "responseCommon": {
    "taskGuid": "string",
    "taskType": "CreateOrUpdateSqlProc",
    "objectId": 0
  }
}

Answer with error

JSON

{
  "responseCommon": {
    "taskGuid": "string",
    "taskType": "CreateOrUpdateSqlProc",
    "objectId": 0
  },
  "error": {
    "wsError": {
      "code": "string",
      "desc": "string"
    },
    "agentError": {
      "code": 0,
      "desc": "string"
    }
  }
}



Example answer
JSON

{
    "taskResponse": {
        "procName": "name"
        "success": true,
        }
    },
    "responseCommon": {
        "taskGuid": "464ca191-8d3a-439b-ad5b-485f628275e6",
        "taskType": "CreateOrUpdateSqlProc",
        "objectId": 199997075
    }
}

Parameter

Parameter type

Mandatory

Description

-procNamestringyesFull procedure name
-successboolyes

Success of the procedure. Takes two values:

  • true — the procedure successfully created or updated
  • false — the procedure not created
errorstring enum
Error container, for more details see the article Error Description