POST - /tenant

POST - /tenant

General Information


Service

API

Method

Data Models

Workflow

Group

Service

API

Method

Data Models

Workflow

Group

multitenant

/tenant

POST

Tenant

N/A

Tenant

Description

Add tenant with optional application, key, and ext key

Input


Type: application/json

Name

Source

Mandatory

Type

Special Format

Description

Name

Source

Mandatory

Type

Special Format

Description

name

Body

YES

String

N/A

Tenant Name

description

Body

YES

String

N/A

Tenant Description

code

Body

NO

String

N/A

Tenant Code

type

Body

YES

String

"enum": ["product", "client"]

Tenant Type

tag

Body

NO

String

N/A

Tenant Tag

console

Body

NO

Boolean

True or False

Tenant is Console or not.

mainTenant

Body - extKey

NO

String

N/A

Main Tenant ID if the new Tenant is a subtenant

profile

Body

NO

Object

N/A



oauth

Body

NO

Object

Check Nested Table Below

OAuth access delegations



Name

Mandatory

Type

Special Format

Description

secret

YES

String

N/A

String for secret of oauth

redirectURI

YES

String

N/A

URI for redirection

grants

YES

Array

Array of Strings



disabled

YES

Integer

"enum": [0, 1]



type

YES

Integer

"enum": [1, 2]



loginMode

YES

Integer

"enum": ["urac", "oauth"]

Login Technology & Method

pin

NO

Object

N/A

Pin Configuration



application

Body

NO

Object

Check Nested Table Below

Tenant Application



Name

Mandatory

Type

Special Format

Description

description

No

String

N/A

Application Description

productCode

YES

String

N/A

Application Product Code

packageCode

YES

String

N/A

Application Product Package

_TTL

YES

String

"enum": ['6', '12', '24', '48', '72', '96', '120', '144', '168']



appKey

YES

Object

appKey Object
"appKey": { "config": {}, "extKey": { "label": %key_label%, "env": %environemnt_name% "expDate": %expiry_date% "device": %device_name%, "geo": %geo_location% } }

You can find details about config object under Tenant Key Configuration

Application Key configuration

If your adding a client tenant and the main tenant id is not included, main tenant id will be used from the external key.



Output


Response

SOAJS has a unified response. Check out this link to understand more the schema of SOAJS response 

Valid Response

Valid Response Sample
{ result: true, data: { _id: '5c0e74ba9acc3c5a84a51259', type: "product", code: "DBTN", name: "Console Tenant", description: "This is the tenant that holds the access rights and configuration for the console users with DSBRD_GUEST as Guest default package", oauth: { secret: "this is a secret", pin: { DSBRD: { enabled: false } }, disabled: 0, type: 2, loginMode: "urac" }, applications: [ { product: "DSBRD", package: "DSBRD_GUEST", description: "Dashboard application for DSBRD_GUEST package", appId: "5c0e74ba9acc3c5a84a5125a", _TTL: 604800000, keys: [ { key: "a139786a6e6d18e48b4987e83789430b", extKeys: [ { extKey: "3d90163cf9d6b3076ad26aa5ed58556348069258e5c6c941ee0f18448b570ad1c5c790e2d2a1989680c55f4904e2005ff5f8e71606e4aa641e67882f4210ebbc5460ff305dcb36e6ec2a2299cf0448ef60b9e38f41950ec251c1cf41f05f3ce9", device: null, geo: null, env: "DASHBOARD", dashboardAccess: true, expDate: null } ], config: { dashboard: { oauth: { loginMode: "urac" }, commonFields: { mail: { from: "me@localhost.com", transport: { type: "sendmail", options: { } } } }, urac: { hashIterations: 1024, seedLength: 32, link: { addUser: "http://dashboard.soajs.org:80/#/setNewPassword", changeEmail: "http://dashboard.soajs.org:80/#/changeEmail/validate", forgotPassword: "http://dashboard.soajs.org:80/#/resetPassword", join: "http://dashboard.soajs.org:80/#/join/validate" }, tokenExpiryTTL: 172800000, validateJoin: true, mail: { join: { subject: "Welcome to SOAJS", path: "undefined/soajs/node_modules/soajs.urac/mail/urac/join.tmpl" }, forgotPassword: { subject: "Reset Your Password at SOAJS", path: "undefined/soajs/node_modules/soajs.urac/mail/urac/forgotPassword.tmpl" }, addUser: { subject: "Account Created at SOAJS", path: "undefined/soajs/node_modules/soajs.urac/mail/urac/addUser.tmpl" }, changeUserStatus: { subject: "Account Status changed at SOAJS", path: "undefined/soajs/node_modules/soajs.urac/mail/urac/changeUserStatus.tmpl" }, changeEmail: { subject: "Change Account Email at SOAJS", path: "undefined/soajs/node_modules/soajs.urac/mail/urac/changeEmail.tmpl" } } } } } } ] } ], tag: "Console", console: true } }

Invalid Response

Error Response Sample
{ "result":false, "errors":{ "codes":[602], "details":[ { "code":602, "message":"Model error: + %model_error%" } ] } }

Response schema

Follow this link to check out the response JSON Schema

SOAJS Error Codes


Code

Description

Code

Description

400

Business logic required data are missing

451

Tenant already exists

452

Main Tenant id is required!

453

Main Tenant is not found!

501

Environment record not found!

602

Model error: + %model_error%