Hooks, Custom API & Steptypes

Indexed SFCC extension point panels in the VS Code sidebar, with the Code Lens that links each implementation back to its registration

The sidebar exposes indexed project views for hooks, custom APIs, and job step types. These panels make SFCC extension points searchable and navigable from the IDE, and the matching Code Lens links each implementation back to the file that registers it

Hooks, Custom API and Steptypes list what the indexes found per cartridge. Row actions open the hooks file, a method's OpenAPI schema or a step definition in steptypes.json

Hooks

The Hooks panel lists the hooks registered in every cartridge's hooks.json. A cartridge's hooks file is found through the hooks entry of its package.json, so a cartridge without that entry shows no hooks

A system hook's function shows the hook it implements, and every function of a custom hook shows hook → function. Click a lens to open its registration in hooks.json
  • The title-bar toggle switches between Show raw hooks, one row per registration, and Group hooks by script, the hooks of each script file together
  • Open Hook Declaration opens the registration in hooks.json, Open hooks file opens the whole file, and Open script file opens the script of a grouped row
  • Search in Hooks opens the find field of the tree, to jump to a hook by name
  • While the index builds, the panel reads Indexing hooks.... A cartridge whose package.json has no hooks entry adds nothing, and an empty panel reminds you to define the hooks file location in package.json

Every script registered in hooks.json gets a Code Lens naming the hook it implements. A system hook shows the hook name, a custom hook adds the exported function, and a click opens the registration

The exported function itself is marked too: a hook icon in the gutter of its line, and a hover that shows the registration as JSON (name and script) with an Open in hooks.json link

Custom API

api.json shows the method and the path of each endpoint, while the script and the schema link to the other two files. Each lens opens its target at the matching operation

The Custom API panel lists the custom SCAPI endpoints of each cartridge: the API folder, its endpoints and paths, and each HTTP method. Each level has its own action:

RowActions
Cartridge or APIOpen Custom SCAPI Endpoints Folder
EndpointOpen Custom SCAPI Path Definition
MethodGo to OpenAPI Schema Definition, Go to API JSON Definition, Go to Script Implementation

Use Search in Custom APIs to open the find field of the tree. The three files of an operation, api.json, the OpenAPI schema, and the script, are also linked by Code Lens, so each one opens the other two at the matching operation

Export to Postman

Export to Postman Collection in the panel's title bar turns every indexed custom API into a Postman collection. The Export Custom APIs to Postman Collection (Beta) picker asks for four values, and keeps them for the next export:

ValueWhat to enter
Collection NameThe name of the collection, also used in the file name
Shop API ClientAn API client from Credentials. Its client ID fills the collection's client variable
TenantThe tenant ID of the instance, such as aanh_003
Short CodeThe short code of your realm

Click Save and Export Collection, then Select Folder. The extension writes <name>_CustomAPIs.postman_collection.json there and reveals it in your file manager. The collection has a folder per cartridge and one request per method, with the SCAPI token requests it needs, so import it into Postman and fill the remaining collection variables

Steptypes

The Steptypes panel lists the custom job steps declared in each cartridge's steptypes.json, both task-oriented and chunk-oriented steps

Each job step function shows the step type and the steptypes.json property that calls it. Click the lens to open that property
  • Open steptypes.json on a cartridge opens its steptypes.json
  • Open definition in steptypes.json on a step opens that step's declaration
  • Search in Steptypes opens the find field of the tree, to jump to a step type by ID
  • While steptypes.json files are read, the panel shows Indexing steptypes.json files...

Each function that a step calls gets a Code Lens that reads step type → property, for example custom.ImportProducts → readFunction. A click opens that property in steptypes.json

Search every index

The same indexes power Smart Search, a picker that finds routes, hooks, step types, custom APIs, and properties by name. See Smart Search

Search Hooks, Search Custom APIs and Search Steptypes open a filterable list grouped by cartridge. The title buttons jump between the indexes and the item buttons open the declaration, schema or script

On this page