We provide an endpoint to run a script on a drawing and an endpoint to request the status of a script job.
Run a script job
Endpoint
POST /startScriptJob
Query parameters
Source Data: One is required
file - Identifier of designated file in backend system
fileUrl - URl to the file to open. Read only access (optional to the file parameter)
File Source:
sessionId - Session id (optional, will be passed in header of requests to the API server)
token - Token (optional, will be passed in header of requests to the API server)
API Server
server - API server (not required if your files are loaded from S3 content bucket)
Partner Authentication (SaaS version only)
auth - application id associated with the partner
userId - partner defined user id
File Conversion (Server version only)
outputPath - path to store resulting file
fileType - DWG, DXF, PDF
dwgVersion - 2018, 2013, 2010, 2007, 2004, 2000
Scripts
script - Url of the script file.
scriptOutputFile - It specifies the filename where the script output is written to. The file is uploaded to partner S3 content bucket logs folder. (optional)
Response
Text: JobID::{jobId}
jobId - unique job id that can be used to request job status.
Script file
Is a text file with extension *.scr that contains commands to execute.
Important: The script should always end with _EXIT command to make sure the server session is exited properly.
Example:
_CIRCLE 15,15 5
_CIRCLE 25,15 5
_EXIT
Get script job status
Endpoint
GET /scriptJobStatus
Query parameters
jobId - job id returned by start script job request
auth - application id associated with the partner (hosted version only)
Response
Text: Job Status::{status}
status - job status (Started, Failed or Successful)
Script job output
If scriptOutputFile parameter was provided with /startScriptJob request, a file with this name will be uploaded to partner’s S3 content bucket logs folder.
If the parameter was not passed, a default output file named {file}.txt will be created.
Considerations for self hosted version
wt_config.xml for job storage table (dynamodb assumed). Set to empty for local storage and disable aws access.
<property name="scriptDb"></property> <property name="aws-access">false</property>