> For the complete documentation index, see [llms.txt](https://docs.smt-x.com/smtx-online-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smt-x.com/smtx-online-documentation/object-lifecycle-manager/service-catalog-api.md). Agents can also search and read this documentation through its [MCP server](https://docs.smt-x.com/smtx-online-documentation/~gitbook/mcp).

# API

The API can be used to read information from and write information to the service catalog.

* **JavaScript (recommended):** every action of the service catalog can be done in server-side JavaScript with `ServiceCatalogInterface`: in processes, JavaScript web services, Studio applications and the other places where scripts run. Since release 7.26.11, this includes all changes to services. The functions, their parameters and the script capability they require are listed on the **JavaScript help** page (Admin > JavaScript help) and in the code completion of the script editors.
* **SOAP web service:** the web service `/ServiceCatalog/Api.asmx` remains available for external systems and existing integrations, see [Inbound SOAP calls](https://docs.smt-x.com/smtx-online-documentation/object-lifecycle-manager/service-catalog-api/inbound-soap-calls). It requires a provider name and security check, which can be requested with SMT-X support.

### Script capabilities

The [script capabilities](https://docs.smt-x.com/smtx-online-documentation/fulfillment-platform/script-capabilities) of a script determine which functions it may use:

| Capability                     | Functions                                                                                                                                                                                     |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *(none)*                       | The *Secure* read functions: they only return what the logged-on user may see.                                                                                                                |
| **ServiceCatalogReadSystem**   | Read the working copy and the published version of every service, ignoring the rights of the logged-on user.                                                                                  |
| **ServiceCatalogManage**       | The *Secure* functions that change services: they act as the logged-on user, with the same rights as on the service detail page (admin rights on the service, ACLs, locks, phase rules, ...). |
| **ServiceCatalogManageSystem** | All functions that change services, ignoring the rights of the logged-on user.                                                                                                                |

### Changing services

* Most functions that change a service have two variants. The function without *Secure* ignores the rights of the logged-on user. The function with the suffix *Secure* (e.g. `updateServicePartValueSecure`) acts as the logged-on user.
* When the logged-on user isn't allowed to do the change, a *Secure* function returns `false`, or `null` for a function that returns a guid (new service, request, document, quality note, review cycle).
* Invalid input and states (unknown service or field, locked service, a value that doesn't meet the constraints of the field, ...) throw an error. A script can catch it with `try`/`catch`.
* The functions without *Secure* accept the option `ActorPerson` (person id, unique id or email): the person shown in the logs and passed to the triggers and events. Without it, no person is used. The *Secure* functions always use the logged-on user.
* The value of a field is converted to the type of the field: a text, a number, a date or the guid of reusable content. `null` clears the value.
* Documents are added from base64. To add a file from the server, read it with `CommonInterface.getFileContentInBase64` (requires the capability FilesSystem).

### Example

```javascript
// create a service, fill in some fields and request its publication
var serviceGuid = ServiceCatalogInterface.createService('ServiceTemplate', { ActorPerson: 'john.doe@example.com' });
ServiceCatalogInterface.updateServiceLanguageField(serviceGuid, 'name', 'My new service', { LanguageId: 1 });
ServiceCatalogInterface.updateServiceField(serviceGuid, 'serviceowner', 'john.doe@example.com');
ServiceCatalogInterface.updateServicePartValue(serviceGuid, 'Description', 'Created by a script');
var requestGuid = ServiceCatalogInterface.addServicePublicationRequest(serviceGuid, { Comments: 'Please publish' });

// as the logged-on user: false when the user may not change the field
if (!ServiceCatalogInterface.updateServicePartValueSecure(serviceGuid, 'Description', 'Changed by the user')) {
  return 'You are not allowed to change the description';
}
```
