Tenant API version v2
http://localhost:8081/{version}
- version: required(v2)
/_/tenant
Create tenant job (create, upgrade, delete) An implementation may choose to return 204 if the job is completed by the initial operation; or it may return 201 and start the operation in the background.
post /_/tenant
Create tenant job (create, upgrade, delete) An implementation may choose to return 204 if the job is completed by the initial operation; or it may return 201 and start the operation in the background.
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "tenantAttributes.schema",
"title": "Tenant job attributes",
"description": "Configuration how to install, upgrade or delete a module for a tenant",
"type": "object",
"properties": {
"module_from": {
"description": "Existing module ID. If omitted, the module is not enabled already",
"type": "string"
},
"module_to": {
"description": "Target module ID. If omitted, the existing module is disabled.",
"type": "string"
},
"purge": {
"description": "On disable should data also be purged",
"type": "boolean"
},
"parameters": {
"description": "Parameters that controls what tenant init (eg reference data)",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "parameters.schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
}
Example:
{
"module_to": "mod-sample-1.3.1",
"module_from": "mod-sample-1.0.2",
"parameters": [
{ "key": "loadReference", "value": "true" }
]
}
HTTP status code 201
Tenant job created
Headers
- Location: required(string)
URI of the job
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "tenantJob.schema",
"title": "Tenant job",
"description": "Tenant job information",
"type": "object",
"properties": {
"id": {
"description": "Job ID",
"type": "string"
},
"tenant": {
"description": "Tenant ID",
"type": "string"
},
"tenantAttributes": {
"description": "Module information - content to initiate operation",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "tenantAttributes.schema",
"title": "Tenant job attributes",
"type": "object",
"properties": {
"module_from": {
"description": "Existing module ID. If omitted, the module is not enabled already",
"type": "string"
},
"module_to": {
"description": "Target module ID. If omitted, the existing module is disabled.",
"type": "string"
},
"purge": {
"description": "On disable should data also be purged",
"type": "boolean"
},
"parameters": {
"description": "Parameters that controls what tenant init (eg reference data)",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "parameters.schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
},
"complete": {
"description": "Whether job is complete (true) or ongoing (false)",
"type": "boolean"
},
"error": {
"description": "Error message if error has occurred",
"type": "string"
},
"messages": {
"description": "Additional messages (warnings, errors)",
"type": "array",
"items": {
"type": "string"
}
}
}
}
Example:
{
"id": "53bd40c8-a420-4ddb-b829-4496ff5e5be4",
"tenant": "diku",
"tenantAttributes" : {
"module_to": "mod-sample-1.3.1",
"module_from": "mod-sample-1.0.2",
"parameters": [
{ "key": "loadReference", "value": "true" }
]
},
"complete": true,
"error": "SQL error",
"messages": [
"first error",
"second error"
]
}
HTTP status code 204
Job completed
HTTP status code 400
Bad user request
Body
Media type: text/plain
Type: any
HTTP status code 422
Validation errors
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "errors.schema",
"description": "A set of errors",
"type": "object",
"properties": {
"errors": {
"description": "List of errors",
"id": "errors",
"type": "array",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "error.schema",
"description": "An error",
"properties": {
"message": {
"type": "string",
"description": "Error message text"
},
"type": {
"type": "string",
"description": "Error message type"
},
"code": {
"type": "string",
"description": "Error message code"
},
"parameters": {
"description": "Error message parameters",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "parameters.schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
},
"required": [
"message"
]
}
},
"total_records": {
"description": "Total number of errors",
"type": "integer"
}
}
}
Example:
{
"errors": [
{
"message": "may not be null",
"type": "1",
"code": "-1",
"parameters": [
{
"key": "moduleTo",
"value": "null"
}
]
}
]
}
HTTP status code 500
Internal error
Body
Media type: text/plain
Type: any
Example:
Internal server error
Get tenant job
Delete job
get /_/tenant/{operation_id}
Get tenant job
URI Parameters
- operation_id: required(string)
Query Parameters
- wait: (integer - default: 0)
wait until job change, but no longer than the wait time - in milliseconds. 0 means "no wait" and is behavior if omitted.
HTTP status code 200
Tenant job returned OK
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "tenantJob.schema",
"title": "Tenant job",
"description": "Tenant job information",
"type": "object",
"properties": {
"id": {
"description": "Job ID",
"type": "string"
},
"tenant": {
"description": "Tenant ID",
"type": "string"
},
"tenantAttributes": {
"description": "Module information - content to initiate operation",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "tenantAttributes.schema",
"title": "Tenant job attributes",
"type": "object",
"properties": {
"module_from": {
"description": "Existing module ID. If omitted, the module is not enabled already",
"type": "string"
},
"module_to": {
"description": "Target module ID. If omitted, the existing module is disabled.",
"type": "string"
},
"purge": {
"description": "On disable should data also be purged",
"type": "boolean"
},
"parameters": {
"description": "Parameters that controls what tenant init (eg reference data)",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "parameters.schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
},
"complete": {
"description": "Whether job is complete (true) or ongoing (false)",
"type": "boolean"
},
"error": {
"description": "Error message if error has occurred",
"type": "string"
},
"messages": {
"description": "Additional messages (warnings, errors)",
"type": "array",
"items": {
"type": "string"
}
}
}
}
Example:
{
"id": "53bd40c8-a420-4ddb-b829-4496ff5e5be4",
"tenant": "diku",
"tenantAttributes" : {
"module_to": "mod-sample-1.3.1",
"module_from": "mod-sample-1.0.2",
"parameters": [
{ "key": "loadReference", "value": "true" }
]
},
"complete": true,
"error": "SQL error",
"messages": [
"first error",
"second error"
]
}
HTTP status code 400
User error
Body
Media type: text/plain
Type: any
HTTP status code 404
Not found
Body
Media type: text/plain
Type: any
HTTP status code 500
Internal error
Body
Media type: text/plain
Type: any
Example:
Internal server error
delete /_/tenant/{operation_id}
Delete job
URI Parameters
- operation_id: required(string)