CLI commands
The documented operac.exe commands and switches are available across recent versions. Run operac.exe --help to review the available switches. Command-line switches are case-sensitive. For example, -v returns the version and -V returns status. Opera codes are case-insensitive. Variable names in math expressions are case-sensitive. Separate command-line arguments with spaces and quote an argument if it contains spaces. Use backslashes in CLI file paths, for example C:\Imports\quote-job.xml. Angle brackets in switch notation mark values to substitute.
When invoked from the command line, operac.exe writes error descriptions to standard error (stderr). Capture stderr separately from standard output when invoking the CLI from an integration.
| Purpose | Switch | Behavior reported by the CLI help |
|---|---|---|
| Identify the installation | -v, -V |
Return the executable version or its status, respectively. |
| Discover tables | -sx |
Print database statistics as XML. |
| Read archives | -L<arch>, -l<arch> |
Print the records list or generate XML records for the selected archive, respectively. |
| Export archive data as XML | -e<arch> |
Export the selected archive. |
| Import archive data | -i<arch> |
Import data into the selected archive. |
| Create or modify a job | -n |
Submit a job XML file. |
| List jobs | -lcom, -lcom-, -lcom-- |
Return job lists with different levels of detail and hashing. |
| Get job details | -g |
Generate job details using -jid<id> and -jyear<year>. The help lists -jwid<id> as optional. |
| Open the calculation report | -gaf, -Yjob_details.xsl, -jid<id>, -jyear<year> |
Retrieve XML for the browser calculation report. |
| Get job materials or cutting lists | -gm, -gl, -go |
Generate job details with materials, a cutting list or an optimized cutting list, respectively. |
| Discover and generate documents | -d-, -d |
List document codes or request document generation, respectively. |
| Get job schemes | -dschema, -jid<id>, -jyear<year> |
Retrieve the job schemes PDF over HTTP. |
| Preview a job | -jp, -jid<id>, -jyear<year> |
Retrieve a graphic preview of the job. |
| Preview a typology | -jwp, -jid<id>, -jyear<year>, -jwid<id> |
Retrieve a raster or vector preview. The WebGL viewer uses -jwp3 for the same job and window-type identifiers. |
| Retrieve an archive image | -pa<arch>, -pid<id>, -pf<format>, -pd<dimensions> |
Request a profile or accessory image by archive record ID. |
| Run a named export filter | -Fname, -F+param=value |
Run the filter named name and supply a filter parameter. See named import and export activities. |
List jobs
The three list variants return XML. Choose the variant based on the fields and change detection your integration needs.
| Switch | Job list |
|---|---|
-lcom |
Full list with detailed job metadata and an MD5 hash. |
-lcom- |
Faster list with fewer fields and a job-level <MD5> element. |
-lcom-- |
Fastest list. Skips MD5 calculation. |
For change detection, store the <MD5> from -lcom- with its <job_id> and <job_year>. Compare that hash with the hash for the same job from a later -lcom- query.
For HTTP, send each switch as a separate query parameter joined by &. For example, use this request to list only jobs from 2023 without hashes:
http://localhost:9001/query?-lcom--&-ayear=2023
See the job list XML for the identifiers and job calculations for the requests that use them.
Export archive data
Use the final three characters of the archive_name from archive statistics as the selector. For example, the archive name OPERASIS gives the selector SIS:
operac -eSIS
An archive can appear in operac -sx even when the CLI reports that its export is unimplemented. A successful export can provide field definitions and records.
Import archive data
operac -i<arch> accepts XML in the archive format produced by operac -e<arch>. For routine updates to an archive with unique record names, omit <ID> and include the archive's name field. A matching name updates the existing row. A name that is absent from the archive adds a row. If the XML supplies <ID>, the import overwrites the row with that primary key. See archive import matching for the field names.
For a concrete file operand example, operac.exe -iprp prices_in_opera_format.xml imports XML into OPERAPRP. See the Excel profile price import example for how to prepare the file.
Use the bare -i switch with an input XML file to let operac select the target archives. It looks for recognized collection tags directly under /jobs/job. One XML file can contain collections for several supported archives. Confirm the exact syntax for passing the input file with your installed build.
HTTP mode
Use -r to start the HTTP server and -rp<port> to set its listening port. For server deployments, see Windows service.
Start the server on port 9001 from a Command Prompt in the configured OperaJM installation directory:
operac.exe -r -rp9001
The server keeps the database open across requests. This avoids opening and closing the database for each command invocation.
HTTP GET and POST URL parameters use CLI command syntax. The following GET requests were tested on build 3.10.1.81:
| Local URL | Response |
|---|---|
http://localhost:9001/query?--help |
Available switches as plain text. |
http://localhost:9001/query?-sx |
Archive statistics as XML. |
http://localhost:9001/query?-eSIS |
Window Systems archive export as XML. |
http://localhost:9001/query?-lcom |
Detailed job list as XML. |
Upload job XML
For -n, POST the input file as multipart/form-data with the part named xml. For example, run this command from the directory containing quote-job.xml.
curl.exe --form "xml=@quote-job.xml;type=application/xml" "http://localhost:9001/query?-n"
On build 3.10.1.81, a successful request returned HTTP 200 with content type text/xml. The XML reported the new job ID and year, the created component IDs and positions, and new=true for the job and its components. See the job creation response for the XML structure.
For other file-taking commands, confirm the upload field for that command. Confirm URL encoding for argument values containing spaces or reserved characters.
Local and remote access
The built-in operac server uses plain HTTP and accepts requests without authenticating callers. Keep the backend reachable only from the local host. Check the actual listening address and use host firewall rules or equivalent network controls if needed. A request to localhost can also reach a server that is listening on other interfaces.
For remote clients, use an API wrapper that terminates HTTPS and authenticates users before forwarding requests to the local operac backend. Keep the backend port inaccessible to remote clients.
HTTP errors
On error, the HTTP server returns a status code such as 404 or 500 with an error description in the response. Check the status and read the description before attempting to parse an XML result.
Windows service
Running operac.exe as a Windows service lets the HTTP server run without an open desktop session. This is useful on a Windows server.
From an elevated Command Prompt in the OperaJM installation directory, use the following installation syntax. Replace <port> with the listening port:
operac.exe -Si -rp<port>
The -S commands require administrative privileges. The CLI help lists these optional installation settings:
| Switch | Purpose |
|---|---|
-Sn<name> |
Sets the service name. |
-Sv<display name> |
Sets the name shown in the Windows Services list. |
-Sd<description> |
Sets the service description. |
Quote the entire switch and value together when the value contains spaces. The help also lists -S+ to start the service, -S- to stop it, and -Su to uninstall it. Run operac.exe --help for the service switches available in your installation.
Service account and database access
Configure the service to log on as a dedicated domain user, such as opera-service. Add that account to the same domain group that grants other Opera users access to the database.
Opera uses a peer-to-peer, file-based database and relies on Windows file permissions and locking. Give the Opera group the read and write access it needs on the database folders and any network shares that host them. The account that runs the service uses those permissions when it opens and updates the database files.