{
  "Name": "Reportworq - Global Pause Control Sample 1.0 (PA v11)",
  "HasSecurityAccess": false,
  "PrologProcedure": "#****Begin: Generated Statements***\r\n#****End: Generated Statements****\r\n\r\n\r\n# PROCESS Overview and Key Information:\r\n\r\n# Reportworq - Global Pause Control Sample 1.0 (PA v11)\r\n#This TI process controls the Reportworq global execution pause through the Reportworq REST API (api/v1). One process, four actions: pause, resume, status and cancelall.\r\n#While Reportworq is paused no new job starts, queued jobs stay Pending, and running jobs hold at their next safe point. This lets a TM1 maintenance process (for example a dimension update) run without waiting behind Reportworq queries.\r\n#With pause and pWaitForPause = true, this process calls the API until Reportworq reports that every running job is held (result = true), or until pMaxWaits calls have been made.\r\n#Each pause adds a hold and logs its holdId. Reportworq stays paused while any hold is active. resume with pHoldId releases only that hold; resume with pHoldId blank is an all-clear: it releases every hold, including one set from the Reportworq Activity screen and any made by another workspace (a deliberate operator action).\r\n#This process never sends a resume without a holdId on its own: only an explicit pAction = resume does that.\r\n#cancelall cancels the jobs of the access token's workspace only.\r\n#The whole process runs on the prolog tab. Please note that you do not need to edit anything on the other tabs of this TI Process.\r\n#This is the variant for IBM Planning Analytics v11 (on-premises, Windows or Linux), which has no ExecuteHttpRequest. For Planning Analytics Engine (v12) and Planning Analytics as a Service use Reportworq - Global Pause Control Sample 1.0 (PA Engine) instead.\r\n#How it calls Reportworq: ExecuteCommand runs curl (cmd /S /C on Windows, sh -c on Linux), curl writes the answer and its HTTP status code to a temporary file in the TM1 log directory (GetProcessErrorFileDirectory), and the helper process Reportworq - Pause Response Reader 1.0 (PA v11) reads that file back. The file is deleted as soon as it has been read.\r\n#Import Reportworq - Pause Response Reader 1.0 (PA v11) too, under that exact name. This process checks that it is there before it sends anything.\r\n#curl ships with Windows 10 version 1803 and later and Windows Server 2019 and later (C:\\Windows\\System32\\curl.exe), and with every common Linux distribution. Set pCurlPath when curl is not on the TM1 server's PATH.\r\n#The access token is passed to curl on its command line and is never written to the TM1 log or to the temporary file.\r\n#Every wait is at most pWaitSeconds (300 or less) and is repeated up to pMaxWaits times; curl gives up 60 seconds after the wait would have ended.\r\n#----------------------------------------------------------------------------\r\n\r\n\r\n# TI PARAMETERS Included definitions:\r\n\r\n# pApiUrl (String): Base address of the Reportworq REST API, ending in api/v1/. Example: https://localhost:8600/api/v1/\r\n# pAccessToken (String): Access token required for API access. In Reportworq: Settings, Configuration, API, Local API keys\r\n# pAction (String): pause, resume, status or cancelall\r\n# pDurationMinutes (String): Whole minutes to stay paused, counted from the moment every running job is held. Blank or 0 pauses until a resume is sent.\r\n# pWaitForPause (String): true or false. For pause only: wait until every running job is held before continuing. Blank means true.\r\n# pWaitSeconds (Numeric): Seconds to wait in one call for the pause to complete, 1 to 300. Default 300.\r\n# pMaxWaits (Numeric): How many waits of pWaitSeconds before giving up. Default 3 (three 5-minute waits).\r\n# pFailIfNotPaused (Numeric): 1 = log an ERROR and stop the process with an error when the pause was not confirmed in time, 0 = log a warning and continue. Default 1.\r\n# pIncludePending (String): true or false. For cancelall only: also cancel jobs that are still Pending in the queue. Blank means false.\r\n# pAcceptSelfSignedCertificate (Numeric): 1 = do not verify the Reportworq TLS certificate (curl option -k), for a self-signed certificate. 0 = verify it. Default 0.\r\n# pHoldId (String): For resume only: the holdId a pause logged. Releases only that hold. Blank releases every pause: an all-clear.\r\n# pCurlPath (String): The curl program to run. Default curl (found on the PATH). Example: C:\\Windows\\System32\\curl.exe or /usr/bin/curl\r\n#----------------------------------------------------------------------------\r\n\r\n\r\n#No edit to below statements needed#\r\n\r\n#Reads each answer back: see the overview above.\r\ncReader = 'Reportworq - Pause Response Reader 1.0 (PA v11)';\r\nStringGlobalVariable( 'gReportworqHttpStatus' );\r\nStringGlobalVariable( 'gReportworqHttpBody' );\r\n\r\nvAccessToken = TRIM(pAccessToken);\r\nvApiUrl = TRIM(pApiUrl);\r\nvAction = LOWER(TRIM(pAction));\r\nvWait = LOWER(TRIM(pWaitForPause));\r\nvIncludePending = LOWER(TRIM(pIncludePending));\r\nvResumeHoldId = TRIM(pHoldId);\r\nvCurlPath = TRIM(pCurlPath);\r\n#The holdId from a pause response; blank until one arrives.\r\nvHoldId = '';\r\n\r\n#Remove surrounding double quotes that are sometimes pasted along with the token or the address.\r\nIF( (LONG(vAccessToken) >= 2) & (SUBST(vAccessToken, 1, 1) @= CHAR(34)) & (SUBST(vAccessToken, LONG(vAccessToken), 1) @= CHAR(34)) );\r\n  vAccessToken = SUBST(vAccessToken, 2, LONG(vAccessToken) - 2);\r\nENDIF;\r\nIF( (LONG(vApiUrl) >= 2) & (SUBST(vApiUrl, 1, 1) @= CHAR(34)) & (SUBST(vApiUrl, LONG(vApiUrl), 1) @= CHAR(34)) );\r\n  vApiUrl = SUBST(vApiUrl, 2, LONG(vApiUrl) - 2);\r\nENDIF;\r\nIF( (LONG(vCurlPath) >= 2) & (SUBST(vCurlPath, 1, 1) @= CHAR(34)) & (SUBST(vCurlPath, LONG(vCurlPath), 1) @= CHAR(34)) );\r\n  vCurlPath = SUBST(vCurlPath, 2, LONG(vCurlPath) - 2);\r\nENDIF;\r\nIF( vCurlPath @= '' );\r\n  vCurlPath = 'curl';\r\nENDIF;\r\n\r\nIF( vApiUrl @= '' );\r\n  LOGOUTPUT( 'ERROR', 'pApiUrl is empty. Example: https://localhost:8600/api/v1/' );\r\n  PROCESSERROR;\r\nENDIF;\r\n#The address is passed to curl, so only a web address is accepted (not file://, ftp:// or another scheme).\r\nvUrlStart = LOWER( vApiUrl );\r\nIF( SUBST( vUrlStart, 1, 7 ) @<> 'http://' & SUBST( vUrlStart, 1, 8 ) @<> 'https://' );\r\n  LOGOUTPUT( 'ERROR', 'pApiUrl must start with http:// or https://. Example: https://localhost:8600/api/v1/' );\r\n  PROCESSERROR;\r\nENDIF;\r\n#pCurlPath is run as a program, so its last path segment must be curl or curl.exe (any folder in front is fine).\r\nnCurlStart = 1;\r\nnCurlPos = 1;\r\nWHILE( nCurlPos <= LONG( vCurlPath ) );\r\n  vCurlChar = SUBST( vCurlPath, nCurlPos, 1 );\r\n  IF( (vCurlChar @= '/') % (vCurlChar @= '\\') );\r\n    nCurlStart = nCurlPos + 1;\r\n  ENDIF;\r\n  nCurlPos = nCurlPos + 1;\r\nEND;\r\nvCurlName = LOWER( SUBST( vCurlPath, nCurlStart, LONG( vCurlPath ) - nCurlStart + 1 ) );\r\nIF( vCurlName @<> 'curl' & vCurlName @<> 'curl.exe' );\r\n  LOGOUTPUT( 'ERROR', 'pCurlPath must end in curl or curl.exe (for example C:\\Windows\\System32\\curl.exe or /usr/bin/curl), because it is run as a program. Nothing was sent to Reportworq.' );\r\n  PROCESSERROR;\r\nENDIF;\r\nIF( vAccessToken @= '' );\r\n  LOGOUTPUT( 'ERROR', 'pAccessToken is empty. Use the Local API access token from Reportworq Settings, Configuration, API, Local API keys.' );\r\n  PROCESSERROR;\r\nENDIF;\r\nIF( SCAN( ' ', vAccessToken ) > 0 );\r\n  LOGOUTPUT( 'ERROR', 'pAccessToken contains a space, which cannot be sent as a request header. Check the token.' );\r\n  PROCESSERROR;\r\nENDIF;\r\nIF( SUBST( vApiUrl, LONG(vApiUrl), 1 ) @<> '/' );\r\n  vApiUrl = vApiUrl | '/';\r\nENDIF;\r\n\r\n#The temporary answer file goes in the TM1 log directory. A backslash in it means a Windows server.\r\nvFolder = TRIM( GetProcessErrorFileDirectory );\r\nIF( vFolder @= '' );\r\n  LOGOUTPUT( 'ERROR', 'The TM1 log directory (GetProcessErrorFileDirectory) is unknown, so there is nowhere to write the Reportworq answer.' );\r\n  PROCESSERROR;\r\nENDIF;\r\nnWindows = 0;\r\nIF( SCAN( '\\', vFolder ) > 0 );\r\n  nWindows = 1;\r\nENDIF;\r\n#A drive letter (C:/TM1/logs) is also a Windows server.\r\nIF( LONG( vFolder ) >= 2 );\r\n  IF( SUBST( vFolder, 2, 1 ) @= ':' );\r\n    nWindows = 1;\r\n  ENDIF;\r\nENDIF;\r\nIF( nWindows = 1 & SUBST( vFolder, LONG( vFolder ), 1 ) @<> '\\' );\r\n  vFolder = vFolder | '\\';\r\nENDIF;\r\nIF( nWindows = 0 & SUBST( vFolder, LONG( vFolder ), 1 ) @<> '/' );\r\n  vFolder = vFolder | '/';\r\nENDIF;\r\n\r\n#These characters could end the quoting of the command line, so they are refused rather than sent.\r\nvRefused = CHAR(34) | CHAR(39) | '`' | '$' | '%' | '<' | '>' | '|' | CHAR(13) | CHAR(10);\r\nvRefusedIn = '';\r\nnChar = 1;\r\nWHILE( nChar <= LONG( vRefused ) );\r\n  vChar = SUBST( vRefused, nChar, 1 );\r\n  IF( SCAN( vChar, vAccessToken ) > 0 );\r\n    vRefusedIn = 'pAccessToken';\r\n  ENDIF;\r\n  IF( SCAN( vChar, vApiUrl ) > 0 );\r\n    vRefusedIn = 'pApiUrl';\r\n  ENDIF;\r\n  IF( SCAN( vChar, vCurlPath ) > 0 );\r\n    vRefusedIn = 'pCurlPath';\r\n  ENDIF;\r\n  IF( SCAN( vChar, vResumeHoldId ) > 0 );\r\n    vRefusedIn = 'pHoldId';\r\n  ENDIF;\r\n  IF( SCAN( vChar, vFolder ) > 0 );\r\n    vRefusedIn = 'the TM1 log directory ' | vFolder;\r\n  ENDIF;\r\n  nChar = nChar + 1;\r\nEND;\r\nIF( vRefusedIn @<> '' );\r\n  LOGOUTPUT( 'ERROR', vRefusedIn | ' contains a quote or one of the characters ` $ % < > | , which cannot be passed safely on the curl command line.' );\r\n  PROCESSERROR;\r\nENDIF;\r\n\r\n#The helper that reads the answers must be installed before anything is sent.\r\nIF( ExecuteProcess( cReader, 'pFile', '' ) <> ProcessExitNormal() );\r\n  LOGOUTPUT( 'ERROR', 'The helper process ' | cReader | ' could not be run. Import it under that exact name, then run this process again. Nothing was sent to Reportworq.' );\r\n  PROCESSERROR;\r\nENDIF;\r\n\r\nIF( vWait @= '' );\r\n  vWait = 'true';\r\nENDIF;\r\nIF( vWait @<> 'true' & vWait @<> 'false' );\r\n  LOGOUTPUT( 'ERROR', 'pWaitForPause must be true or false: ' | pWaitForPause );\r\n  PROCESSERROR;\r\nENDIF;\r\nIF( vIncludePending @= '' );\r\n  vIncludePending = 'false';\r\nENDIF;\r\nIF( vIncludePending @<> 'true' & vIncludePending @<> 'false' );\r\n  LOGOUTPUT( 'ERROR', 'pIncludePending must be true or false: ' | pIncludePending );\r\n  PROCESSERROR;\r\nENDIF;\r\n\r\n#Whole minutes only. Blank or 0 means no duration, so the pause lasts until a resume is sent.\r\nnDuration = 0;\r\nIF( TRIM(pDurationMinutes) @<> '' );\r\n  nDuration = ROUNDP( NUMBR( TRIM(pDurationMinutes) ), 0 );\r\nENDIF;\r\nIF( nDuration < 0 );\r\n  LOGOUTPUT( 'ERROR', 'pDurationMinutes must be blank, 0 or a positive number of minutes: ' | pDurationMinutes );\r\n  PROCESSERROR;\r\nENDIF;\r\n\r\n#The API accepts 1 to 300 seconds per wait.\r\nnWaitSeconds = pWaitSeconds;\r\nIF( nWaitSeconds < 1 );\r\n  nWaitSeconds = 300;\r\nENDIF;\r\nIF( nWaitSeconds > 300 );\r\n  nWaitSeconds = 300;\r\nENDIF;\r\nnMaxWaits = ROUNDP( pMaxWaits, 0 );\r\nIF( nMaxWaits < 1 );\r\n  nMaxWaits = 1;\r\nENDIF;\r\n\r\n#Build the request address for the chosen action.\r\nnWaiting = 0;\r\nIF( vAction @= 'pause' );\r\n  vUrl = vApiUrl | 'pause?waitForPause=' | vWait | '&waitSeconds=' | TRIM( STR( nWaitSeconds, 10, 0 ) );\r\n  IF( nDuration > 0 );\r\n    vUrl = vUrl | '&duration=' | TRIM( STR( nDuration, 10, 0 ) );\r\n  ENDIF;\r\n  IF( vWait @= 'true' );\r\n    nWaiting = 1;\r\n  ENDIF;\r\nELSEIF( vAction @= 'resume' );\r\n  vUrl = vApiUrl | 'resume';\r\n  IF( vResumeHoldId @<> '' );\r\n    vUrl = vUrl | '?holdId=' | vResumeHoldId;\r\n  ENDIF;\r\nELSEIF( vAction @= 'status' );\r\n  vUrl = vApiUrl | 'pause/status';\r\nELSEIF( vAction @= 'cancelall' );\r\n  vUrl = vApiUrl | 'cancelall?includePending=' | vIncludePending;\r\nELSE;\r\n  LOGOUTPUT( 'ERROR', 'pAction must be pause, resume, status or cancelall: ' | pAction );\r\n  PROCESSERROR;\r\nENDIF;\r\n\r\n#Only a pause that waits is repeated. Every other action is a single call.\r\nnMaxAttempts = 1;\r\nIF( nWaiting = 1 );\r\n  nMaxAttempts = nMaxWaits;\r\nENDIF;\r\n\r\n#The curl command line, without the address and the answer file. Each request adds its own --max-time: a little longer than the wait, so curl never gives up before Reportworq answers.\r\n#The last line curl writes is the HTTP status code (000 when there was no answer).\r\nIF( nWindows = 1 );\r\n  vQ = CHAR(34);\r\n  vShellStart = 'cmd /S /C ' | CHAR(34);\r\nELSE;\r\n  vQ = CHAR(39);\r\n  vShellStart = 'sh -c ' | CHAR(34);\r\nENDIF;\r\nvShellEnd = CHAR(34);\r\nvCurl = vShellStart | vQ | vCurlPath | vQ | ' -s -X POST -H ' | vQ | 'accessToken: ' | vAccessToken | vQ | ' -H ' | vQ | 'Content-Type: application/json' | vQ | ' -d ' | vQ | '{}' | vQ | ' -w ' | vQ | '\\n%{http_code}' | vQ;\r\nIF( pAcceptSelfSignedCertificate = 1 );\r\n  vCurl = vCurl | ' -k';\r\nENDIF;\r\nvResponseFile = vFolder | 'ReportworqPause_' | TIMST( NOW, '\\Y\\m\\d\\h\\i\\s' ) | '_' | TRIM( STR( INT( RAND * 1000000 ), 10, 0 ) ) | '.txt';\r\nvResponseFileQuoted = vQ | vResponseFile | vQ;\r\nnMaxTime = 60;\r\nIF( nWaiting = 1 );\r\n  nMaxTime = nWaitSeconds + 60;\r\nENDIF;\r\n\r\nnAttempt = 0;\r\nnOk = 0;\r\nnFatal = 0;\r\nWHILE( nOk = 0 & nFatal = 0 & nAttempt < nMaxAttempts );\r\n  nAttempt = nAttempt + 1;\r\n  IF( nWaiting = 1 );\r\n    LOGOUTPUT( 'INFO', 'Reportworq pause: wait ' | TRIM( STR( nAttempt, 10, 0 ) ) | ' of ' | TRIM( STR( nMaxAttempts, 10, 0 ) ) | ', up to ' | TRIM( STR( nWaitSeconds, 10, 0 ) ) | ' seconds.' );\r\n  ELSE;\r\n    LOGOUTPUT( 'INFO', 'Reportworq ' | vAction | ': sending the request.' );\r\n  ENDIF;\r\n\r\n  #Send the request and read the answer back. The token is only ever sent as a header and is never written to the log.\r\n  ExecuteCommand( vCurl | ' --max-time ' | TRIM( STR( nMaxTime, 10, 0 ) ) | ' ' | vQ | vUrl | vQ | ' > ' | vResponseFileQuoted | vShellEnd, 1 );\r\n  gReportworqHttpStatus = '0';\r\n  gReportworqHttpBody = '';\r\n  ExecuteProcess( cReader, 'pFile', vResponseFile );\r\n  nStatus = NUMBR( gReportworqHttpStatus );\r\n  sBody = LOWER( gReportworqHttpBody );\r\n  IF( FileExists( vResponseFile ) = 1 );\r\n    ASCIIDelete( vResponseFile );\r\n  ENDIF;\r\n\r\n  IF( nStatus = 200 );\r\n    LOGOUTPUT( 'INFO', 'Reportworq answered: ' | sBody );\r\n    IF( vAction @= 'pause' );\r\n      #Keep the id of the hold this call added, so the resume releases only this process's pause (an administrator's own pause stays in force).\r\n      nHoldPos = SCAN( '\"holdid\":\"', sBody );\r\n      nHoldSkip = 10;\r\n      IF( nHoldPos = 0 );\r\n        nHoldPos = SCAN( '\"holdid\": \"', sBody );\r\n        nHoldSkip = 11;\r\n      ENDIF;\r\n      vNewHoldId = '';\r\n      IF( nHoldPos > 0 );\r\n        vHoldRest = SUBST( sBody, nHoldPos + nHoldSkip, LONG( sBody ) - nHoldPos - nHoldSkip + 1 );\r\n        nHoldEnd = SCAN( CHAR(34), vHoldRest );\r\n        IF( nHoldEnd > 1 );\r\n          vNewHoldId = SUBST( vHoldRest, 1, nHoldEnd - 1 );\r\n        ENDIF;\r\n      ENDIF;\r\n      #A repeated wait adds a new hold, so release the one the previous wait added (the new one keeps Reportworq paused).\r\n      IF( vHoldId @<> '' & vNewHoldId @<> '' & vNewHoldId @<> vHoldId );\r\n        ExecuteCommand( vCurl | ' --max-time 60 ' | vQ | vApiUrl | 'resume?holdId=' | vHoldId | vQ | ' > ' | vResponseFileQuoted | vShellEnd, 1 );\r\n        IF( FileExists( vResponseFile ) = 1 );\r\n          ASCIIDelete( vResponseFile );\r\n        ENDIF;\r\n      ENDIF;\r\n      IF( vNewHoldId @<> '' );\r\n        vHoldId = vNewHoldId;\r\n        LOGOUTPUT( 'INFO', 'Reportworq pause hold: ' | vHoldId );\r\n      ENDIF;\r\n    ENDIF;\r\n    IF( nWaiting = 1 );\r\n      #The API answers {\"result\":true,...} once every running job is held, {\"result\":false,...} when the wait ran out.\r\n      IF( SCAN( '\"result\":true', sBody ) > 0 % SCAN( '\"result\": true', sBody ) > 0 );\r\n        nOk = 1;\r\n      ELSE;\r\n        LOGOUTPUT( 'INFO', 'Reportworq is not fully paused yet: running jobs are still finishing their current step.' );\r\n      ENDIF;\r\n    ELSE;\r\n      nOk = 1;\r\n    ENDIF;\r\n  ELSE;\r\n    IF( nStatus = 0 );\r\n      LOGOUTPUT( 'ERROR', 'No answer from Reportworq at ' | vApiUrl | '. Check pApiUrl, that curl runs on this server (pCurlPath: ' | vCurlPath | '), and pAcceptSelfSignedCertificate for a self-signed certificate.' );\r\n    ELSE;\r\n      LOGOUTPUT( 'ERROR', 'Reportworq answered HTTP ' | TRIM( STR( nStatus, 10, 0 ) ) | ': ' | sBody );\r\n    ENDIF;\r\n    IF( vAction @= 'resume' & nStatus = 404 & vResumeHoldId @<> '' );\r\n      LOGOUTPUT( 'ERROR', 'No active pause hold ' | vResumeHoldId | ': it was already released or has expired. Leave pHoldId blank to release every pause (an all-clear).' );\r\n    ENDIF;\r\n    #No answer, request timeout or a gateway problem can be retried while waiting. Anything else (bad token, bad address) cannot.\r\n    IF( nWaiting = 1 & ( nStatus = 0 % nStatus = 408 % nStatus = 502 % nStatus = 503 % nStatus = 504 ) );\r\n      LOGOUTPUT( 'WARN', 'Trying again.' );\r\n    ELSE;\r\n      nFatal = 1;\r\n    ENDIF;\r\n  ENDIF;\r\nEND;\r\n\r\nIF( nOk = 1 );\r\n  LOGOUTPUT( 'INFO', 'Reportworq ' | vAction | ' completed.' );\r\n  IF( vAction @= 'pause' & vHoldId @<> '' );\r\n    LOGOUTPUT( 'INFO', 'To release only this pause, run resume with pHoldId = ' | vHoldId );\r\n  ENDIF;\r\n  IF( vAction @= 'pause' & vHoldId @= '' );\r\n    LOGOUTPUT( 'WARN', 'The holdId of this pause is unknown (the answer did not carry one). Resume it by hand: run resume with pHoldId blank, or use Resume jobs on the Reportworq Activity screen.' );\r\n  ENDIF;\r\nELSE;\r\n  IF( nWaiting = 1 & nFatal = 0 );\r\n    IF( vHoldId @<> '' );\r\n      LOGOUTPUT( 'ERROR', 'Reportworq was not fully paused after ' | TRIM( STR( nMaxAttempts, 10, 0 ) ) | ' waits of ' | TRIM( STR( nWaitSeconds, 10, 0 ) ) | ' seconds. The pause is still requested: run resume with pHoldId = ' | vHoldId | ' to lift it.' );\r\n    ELSE;\r\n      LOGOUTPUT( 'ERROR', 'Reportworq was not fully paused after ' | TRIM( STR( nMaxAttempts, 10, 0 ) ) | ' waits of ' | TRIM( STR( nWaitSeconds, 10, 0 ) ) | ' seconds. The pause may still be requested and its holdId is unknown, so it was not released: resume it by hand (run resume with pHoldId blank, or use Resume jobs on the Reportworq Activity screen).' );\r\n    ENDIF;\r\n  ELSE;\r\n    LOGOUTPUT( 'ERROR', 'Reportworq ' | vAction | ' failed. Check pApiUrl, pAccessToken, pCurlPath and the pAcceptSelfSignedCertificate setting.' );\r\n  ENDIF;\r\n  IF( vAction @<> 'pause' % pFailIfNotPaused <> 0 % nFatal = 1 );\r\n    PROCESSERROR;\r\n  ENDIF;\r\nENDIF;\r\n",
  "MetadataProcedure": "\r\n#****Begin: Generated Statements***\r\n#****End: Generated Statements****",
  "DataProcedure": "\r\n#****Begin: Generated Statements***\r\n#****End: Generated Statements****",
  "EpilogProcedure": "\r\n#****Begin: Generated Statements***\r\n#****End: Generated Statements****",
  "Parameters": [
    {
      "Name": "pApiUrl",
      "Prompt": "Base address of the Reportworq REST API, ending in api/v1/",
      "Value": "https://localhost:8600/api/v1/",
      "Type": "String"
    },
    {
      "Name": "pAccessToken",
      "Prompt": "Access token required for API access, in Reportworq: Settings, Configuration, API, Local API keys",
      "Value": "",
      "Type": "String"
    },
    {
      "Name": "pAction",
      "Prompt": "Action: pause, resume, status or cancelall",
      "Value": "status",
      "Type": "String"
    },
    {
      "Name": "pDurationMinutes",
      "Prompt": "Pause only: whole minutes to stay paused once every running job is held, blank or 0 = until resumed",
      "Value": "",
      "Type": "String"
    },
    {
      "Name": "pWaitForPause",
      "Prompt": "Pause only: wait until every running job is held (true/false)",
      "Value": "true",
      "Type": "String"
    },
    {
      "Name": "pWaitSeconds",
      "Prompt": "Seconds to wait in one call for the pause to complete (1 to 300)",
      "Value": 300,
      "Type": "Numeric"
    },
    {
      "Name": "pMaxWaits",
      "Prompt": "How many waits of pWaitSeconds before giving up",
      "Value": 3,
      "Type": "Numeric"
    },
    {
      "Name": "pFailIfNotPaused",
      "Prompt": "Stop the process with an error when the pause is not confirmed in time (1 = yes, 0 = continue)",
      "Value": 1,
      "Type": "Numeric"
    },
    {
      "Name": "pIncludePending",
      "Prompt": "Cancel all only: also cancel jobs that are still Pending (true/false)",
      "Value": "false",
      "Type": "String"
    },
    {
      "Name": "pAcceptSelfSignedCertificate",
      "Prompt": "1 = do not verify the Reportworq TLS certificate (self-signed, curl option -k), 0 = verify it",
      "Value": 0,
      "Type": "Numeric"
    },
    {
      "Name": "pHoldId",
      "Prompt": "Resume only: the holdId a pause logged, to release only that hold (blank = release every pause: an all-clear)",
      "Value": "",
      "Type": "String"
    },
    {
      "Name": "pCurlPath",
      "Prompt": "The curl program to run, for example C:\\Windows\\System32\\curl.exe or /usr/bin/curl (blank = curl on the PATH)",
      "Value": "curl",
      "Type": "String"
    }
  ]
}