OCAPI is optional in Intellij SFCC. Turn it on for a connection to activate code versions from B2C Explorer and to run jobs from the B2C OCAPI tool window at the bottom of the IDE. Uploads, deploys, B2C Explorer and the debugger don't need it, they use the connection's account
Set up OCAPI
Add an API client
On the OCAPI tab of B2C Credentials, add your API client with its client ID and secret. On sandboxes and test systems you can start with the built-in OOTB Test Creds client
Allow the client on the instance
Grant the client the Data API resources below in Business Manager, see Business Manager setup
Turn it on for the connection
In Connections Settings, open the OCAPI tab, check Use OCAPI, pick the Credentials and the Version, then click Test OCAPI Connection
Business Manager setup
- In Business Manager, go to Administration › Site Development › Open Commerce API Settings
- Select Data API and Global
- Add a client entry like the one below, with your client ID and an OCAPI version your instance supports, then save
{
"_v": "23.2",
"clients": [
{
"client_id": "<your-client-id>",
"resources": [
{
"resource_id": "/code_versions/*",
"methods": ["patch"],
"read_attributes": "(**)",
"write_attributes": "(**)"
},
{
"resource_id": "/jobs/*/executions",
"methods": ["post"],
"read_attributes": "(**)",
"write_attributes": "(**)"
},
{
"resource_id": "/jobs/*/executions/*",
"methods": ["get"],
"read_attributes": "(**)",
"write_attributes": "(**)"
}
]
}
]
}These are the three calls the plugin makes: activate a code version, start a job execution and read its status. If the settings already list other clients, add your entry to the existing clients array instead of replacing it
No WebDAV client permissions needed
Guides for command line tools often add WebDAV Client Permissions for the API client too. Intellij SFCC doesn't need them, because its WebDAV requests use the connection's account (password or WebDAV access key), not the API client
Obtain a Business Manager user grant on the connection's OCAPI tab requests the token from the instance itself instead of Account Manager. Leave it off unless your setup needs that grant
Activate a code version
With OCAPI on, right-click a version under Code versions in B2C Explorer
| Item | What it does |
|---|---|
| Activate and Select Code Version | Activates the version on the instance and selects it for uploads and deploys |
| Activate Code Version | Activates the version on the instance only |
| Select Code Version | Selects it for uploads and deploys without activating it. This one works without OCAPI |
The activated version is marked "[Active on instance]" in the tree and in the toolbar code version list. More on code versions in Deploy Code
B2C OCAPI tool window
The window has one tab per instance. With no tab yet it shows "No OCAPI Configurations"
- Click + (New OCAPI Connection), choose the Instance and click Create. Pick a connection, groups can't be used
- The tab toolbar shows the connection's settings and lets you change them in place
| Toolbar | What it does |
|---|---|
| Use OCAPI: | Turns OCAPI on or off for the connection, same as Use OCAPI in Connections Settings |
| Instance: | The connection the tab works with, plus Edit Connection to open its settings |
| Credentials: | The API client used for requests |
| Version: | The OCAPI version used for requests |
Closing a tab asks before it removes that OCAPI connection from the window
Run jobs
The Jobs tab lists job IDs with their status. Add them by hand or find them in your code
| Action | What it does |
|---|---|
| Find Jobs in jobs.xml | Adds every job-id found in the project's jobs.xml files |
| Add Job | Adds one job by ID ("Enter Job ID") |
| Run Job | Starts the selected jobs. With several selected it reads "Run 3 Jobs" |
| Remove Job | Removes the selected jobs from the list after a confirmation. The jobs on the instance are not touched |
A running job shows "(Running)" after its ID, and its Status is refreshed every 2 seconds until it ends, for example with OK or ERROR. A job that is still pending or running can't be started again. Right-click a row to run or remove it
Troubleshooting
| Message | What to do |
|---|---|
| OCAPI Not Enabled | Turn on Use OCAPI for the connection, then try again |
| "OCAPI is not configured for" the instance | Enable OCAPI, select the credentials and the version, and validate the connection |
| OCAPI Auth Failed | The client ID or secret is wrong, or the client is not allowed on this instance |
| OCAPI Error with a message from the server | Usually missing permissions. The balloon's Edit Data API opens the Business Manager page from Business Manager setup |
| Running Job Error | The job ID doesn't exist on the instance, or the client can't run jobs |
| Run Job is disabled | OCAPI is off for the tab, nothing is selected, or the selected job is still running |