@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api PAC Control REST API
@version R1.0a
@auth basic
@endpoints 55
@hint download_for_search
@toc device(55)

@endpoint GET /device
@desc Returns controller's type; firmware version; both mac addresses; and uptime in seconds
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy
@desc Returns the name, date, time, and CRC of the strategy currently in the controller, and the number of charts currently running. Empty strings and a 0 will be returned when there is no strategy.
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/ios/analogInputs
@desc Returns the name and engineering units (EU) for all analog input points in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/ios/analogInputs/{ioName}/eu
@desc Reads the value in engineering units (EU) of the specified analog input
@required {ioName: any # Name of the analog input point to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/ios/analogOutputs
@desc Returns the name and engineering units (EU) for all analog output points in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/ios/analogOutputs/{ioName}/eu
@desc Reads the value in engineering units (EU) of the specified analog output
@required {ioName: any # Name of analog output point to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/ios/analogOutputs/{ioName}/eu
@desc Sets the value of the specified analog output point
@required {ioName: any # Name of the analog output point to write, body: map # Value to write}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/ios/digitalInputs
@desc Returns the name and state (true = on, false = off) of all digital input points in the strategy. If there is no strategy in the controller, or the strategy includes no digital inputs, the returned array will be empty.
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/ios/digitalInputs/{ioName}/state
@desc Returns the specified digital input point's state (true = on, false = off)
@required {ioName: any # Name of the digital input point to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/ios/digitalOutputs
@desc Returns the name and state (true = on, false = off) of all digital output points in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/ios/digitalOutputs/{ioName}/state
@desc Returns the specified digital output point's state (true = on, false = off)
@required {ioName: any # Name of the digit output point to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/ios/digitalOutputs/{ioName}/state
@desc Sets the value of the specified digital output point
@required {ioName: any # Name of the digital output point to write, body: map # Value to write}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/floats
@desc Returns an array of the name and length of all the float tables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/tables/floats/{tableName}
@desc Read table elements
@required {tableName: any # Name of float table to read; starting index and number of elements may be specified (defaults to all elements)}
@optional {startIndex: any # Index of first element to read (default is 0), numElements: any # Number of elements to read (default is number of elements in the table minus startIndex)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/floats/{tableName}
@desc Write table elements
@required {tableName: any # Name of float table to write; starting index may be specified, floatArray: [num(float)] # Array of element values to write starting at startIndex}
@optional {startIndex: any # Index of first element to write (default is 0)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/floats/{tableName}/{index}
@desc Read specified table element
@required {tableName: any # Name of float table to read, index: any # Index of element to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/floats/{tableName}/{index}
@desc Write specified table element
@required {tableName: any # Name of float table to write, index: any # Index of element to write, FloatElementObject: map # Element to write starting at index}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int32s
@desc Returns an array of the name and length of all the integer32 tables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/tables/int32s/{tableName}
@desc "Read a range of table elements from the specified integer32 table"
@required {tableName: any # Name of integer32 table to read; starting index and number of elements may be specified (defaults to all elements)}
@optional {startIndex: any # Index of first element to read (default is 0), numElements: any # Number of elements to read (default is number of elements in the table minus startIndex)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int32s/{tableName}
@desc "Write a range of table elements"
@required {tableName: any # Name of integer32 table to write; starting index may be specified, int32Array: [int(int32)] # Array of element values to write starting at startIndex; if the list of elements is too long to fit in the specified table, extra elements will be ignored}
@optional {startIndex: any # Index of first element to write (default is 0)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int32s/{tableName}/{index}
@desc Read specified integer32 table element
@required {tableName: any # Name of the integer32 table to read, index: any # Index of element to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int32s/{tableName}/{index}
@desc Write specified integer32 table element
@required {tableName: any # Name of the integer32 table to write, index: any # Index of element to write, int32ElementObject: map # Element to write at index specified}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int64s
@desc Returns an array of the name and length of all the integer64 tables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/tables/int64s/{tableName}
@desc "Read a range of table elements from the specified integer64 table"
@required {tableName: any # Name of the integer64 table to read; starting index and number of elements may be specified (defaults to all elements)}
@optional {startIndex: any # Index of first element to read (default is 0), numElements: any # Number of elements to read (default is number of elements in the table minus startIndex)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int64s/{tableName}
@desc "Write a range of table elements"
@required {tableName: any # Name of integer64 table to write; starting index may be specified, int64Array: [int(int64)] # Array of element values to write starting at startIndex; if the array of elements is too long to fit in the specified table, extra elements will be ignored}
@optional {startIndex: any # Index of first element to write; default is 0}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int64s/{tableName}/_string
@desc "Read a range of table elements from the specified integer64 table"
@required {tableName: any # Name of the integer64 table to read; starting index and number of elements may be specified (defaults to all elements)}
@optional {startIndex: any # Index of first element to read (default is 0), numElements: any # Number of elements to read (default is number of elements in the table minus startIndex)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int64s/{tableName}/_string
@desc "Write a range of table elements"
@required {tableName: any # Name of integer64 table to write; starting index may be specified, int64AsStringArray: [str] # Array of element values to write starting at startIndex; if the array of elements is too long to fit in the specified table, extra elements will be ignored}
@optional {startIndex: any # Index of first element to write; default is 0.}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int64s/{tableName}/{index}
@desc Read specified integer64 table element
@required {tableName: any # Name of integer64 table to read, index: any # Index of element to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int64s/{tableName}/{index}
@desc Write specified integer64 table element
@required {tableName: any # Name of the integer64 table to write, index: any # Index of element to write, int64ElementObject: map # Element to write starting at index specified}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/int64s/{tableName}/{index}/_string
@desc Read specified integer64 table element as string
@required {tableName: any # Name of integer64 table to read, index: any # Index of element to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/int64s/{tableName}/{index}/_string
@desc Write specified integer64 table element as string
@required {tableName: any # Name of the integer64 table to write, index: any # Index of element to write, int64ElementObject: map # Element to write starting at index specified}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/strings
@desc Returns an array of the name and length of all the string tables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/tables/strings/{tableName}
@desc "Read a range of table elements from the specified string table"
@required {tableName: any # Name of string table to read; starting index and number of elements may be specified (defaults to all elements)}
@optional {startIndex: any # Index of first element to read (default is 0), numElements: any # Number of elements to read (default is number of elements in the table minus startIndex)}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/strings/{tableName}
@desc "Write a range of table elements"
@required {tableName: any # Name of string table to write; starting index may be specified, stringArray: [str] # Array of element values to write starting at startIndex; if an element value is longer than the string width, the string will be truncated to fit}
@optional {startIndex: any # Index of first element to write (default is 0)}
@returns(200) OK - but check details for any error messages
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/tables/strings/{tableName}/{index}
@desc Read specified table element
@required {tableName: any # Name of string table to read, index: any # Index of element to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/tables/strings/{tableName}/{index}
@desc Write specified table element
@required {tableName: any # Name of string table to write, index: any # Index of element to write, stringElementObject: map # Element to write starting at index}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/downTimers
@desc Returns the name and current value of all down timers in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/downTimers/{downTimerName}/value
@desc Returns current value of the specified down timer
@required {downTimerName: any # Name of the down timer variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/floats
@desc Returns the name and value of all (single-precision) float variables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/floats/{floatName}
@desc Returns value of the specified float variable
@required {floatName: any # Name of float variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/vars/floats/{floatName}
@desc Sets the value of a float variable
@required {floatName: any # Name of the float variable to write, body: map # Value to write to the float variable}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/int32s
@desc Returns the name and value of all integer32 variables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/int32s/{int32Name}
@desc Returns value of the specified integer32 variable
@required {int32Name: any # Name of integer32 variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/vars/int32s/{int32Name}
@desc Sets the value of an integer32 variable
@required {int32Name: any # Name of integer32 variable to write, body: map # Value to write to the integer32 variable}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/int64s
@desc Returns the name and value of all integer64 variables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/int64s/_string
@desc Returns the name and value as a string of all integer64 variables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/int64s/{int64Name}
@desc Returns value of the specified integer64 variable
@required {int64Name: any # Name of integer64 variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/vars/int64s/{int64Name}
@desc Sets the value of an integer64 variable
@required {int64Name: any # Name of integer64 variable to write, body: map # Value to write to the integer64 variable}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/int64s/{int64Name}/_string
@desc Returns value of the specified integer64 variable as a string
@required {int64Name: any # Name of integer64 variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/vars/int64s/{int64Name}/_string
@desc Sets the value of an integer64 variable as a string
@required {int64Name: any # Name of integer64 variable to write, body: map # Value to write to the integer64 variable}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/strings
@desc Returns the name and value of all string variables in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/strings/{stringName}
@desc Returns value of the specified string
@required {stringName: any # Name of string variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint POST /device/strategy/vars/strings/{stringName}
@desc Sets the value of a string variable
@required {stringName: any # Name of string variable to write, body: map # String to write. If the value is longer than the string width, the string will be truncated to fit.}
@returns(200) OK - but check details for any error messages
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@endpoint GET /device/strategy/vars/upTimers
@desc Returns the name and current value of all up timers in the strategy
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized}

@endpoint GET /device/strategy/vars/upTimers/{upTimerName}/value
@desc Returns current value of the specified up timer
@required {upTimerName: any # Name of the up timer variable to read}
@returns(200) OK
@errors {400: Bad Request, 401: Unauthorized, 404: Not found}

@end
