SOAP client for OX App Suite
This project provides an API facade for the OX App Suite Middleware SOAP API, making it easy to interact with provisioning endpoints such as contexts, users, secondary accounts, and more.
- API Facade: Programmatically access and manage OX App Suite resources via a simple JavaScript API.
- Provisioning Script: Easily create, update, and delete contexts, users, and secondary accounts from the command line.
- Configurable: Uses .env files for environment-specific configuration.
You can use the built-in provisioning script to automate resource creation. Simply run:
``sh`
npx @open-xchange/soap-client
If you already have installed the package in your project, you can run the script directly:
`sh`
pnpm provision.js
This will execute the provisioning tool, which reads configuration from a JSON file (default: ./provisioning.json). You can specify a different file with the -f option:
`sh`
npx @open-xchange/soap-client -f example-provisioning.json
The JSON file should contain the resources to provision. For example:
`json`
{
"contexts": [
{
"data": {
"name": "test",
"capabilities": "foo,bar",
"config": {
"entries": [{
"key": "config",
"value": {
"entries": [
{ "key": "io.ox/core//foobar", "value": "false" }
]
}
}]
}
},
"users": [
{
"name": "testuser",
"primaryEmail": "testuser-123@example.com",
"display_name": "Test User",
"imapLogin": "testuser-123",
"imapServer": "main-dovecot",
"smtpServer": "main-postfix",
"email1": "testuser-123@box.ox.io",
"password": "supersecret",
"sur_name": "User",
"given_name": "Test"
}
],
"secondaryAccount":
{
"name": "info",
"login": "info@example.com",
"primaryAddress": "info@example.com",
"mailEndpointSource": "primary",
"transportEndpointSource": "primary",
"personal": "Info"
}
}
]
}
The CLI supports creating contexts, users, and secondary accounts:
`sh`
npx @open-xchange/soap-client create context --name my-context
npx @open-xchange/soap-client create user --context-id 123 --email user@example.com --name myuser
npx @open-xchange/soap-client create account --context-id 123 --name info --email info@example.com --users 1,2,3
`sh`
npx @open-xchange/soap-client delete context --id 123
npx @open-xchange/soap-client delete user --context-id 123 --id 456
npx @open-xchange/soap-client delete account --context-id 123 --email info@example.com --users 1,2,3
You can also use the API programmatically in your Node.js projects and choose between either the common or the reseller API when doing so by importing the respective service:
`js
import { contextService, userService } from '@open-xchange/soap-client/common'
const context = await contextService.create({ name: 'my-context' })
const user = await userService.create(context, { name: 'myuser', email1: 'user@example.com' })
`
Set up your .env file with the required environment variables. See .env.default` for an example.
---
For more details, see the bin/provision.js script and the services directory.