The OpCon API is a powerful interface that allows users to interact programmatically with the OpCon automation platform. Whether you're looking to automate tasks, integrate with external systems, or streamline workflows, the API provides the flexibility and control to make it happen.
What is the OpCon API?
The OpCon API is a RESTful interface used by the OpCon web interface to perform actions such as job scheduling, property management, and system monitoring. It enables users to:
- Retrieve and update job details
- Manager global and instance properties
- Evaluate expressions
- Interact with schedules and scripts
- Authenticate securely using tokens
Ā Prerequisites
Before you begin, ensure the following:
- You are an OpCon client with access to Solution Manager.
- Your user role has permissions to generate and use external tokens.
- You know your OpCon server URL.
Authentication
Authentication is required for most API calls. You can generate a token in two ways:
Via Solution Manager
- Navigate to your User Profile
- Select External Token
- Click Generate Token
- Copy the token for use in API calls
Note: If you donātĀ see the External Token option, check your user permissions or OpCon version.
Via API Call
Use a POST request to /tokens with your credentials to receive a token. This method is useful for scripting and automation.
Testing with Swagger
OpCon provides a Swagger interface for exploring and testing API endpoints.
Accessing Swagger:
https://<your-server>/api-doc/index.html
Features:
- Try out endpoints directly in the browser.
- View request/response formats.
- Authenticate using your token.
Tip: Use theĀ āAuthorizeā button in Swagger and prefix your token with Token (note the space).
Ā
Useful Endpoints to Start With
Endpoint | Description |
/version | Get the current API version (no authentication required) |
/tokens | Generate authentication tokens |
/properties/global | Retrieve global properties |
/expressions/evaluate | Test property expressions |
/jobs | Retrieve or update job details |
Ā
Common Pitfalls
- Missing Token Prefix: Always prefix your token with Token in the Authorization header.
- Expired Tokens: User tokens expire (e.g., after 20 minutes). Application tokens do not.
- Permissions: API access is governed by your OpCon role. Unauthorized actions will return errors.
Ā