16. REST CORS

System-level: Add CORS

URL: /admin/api/v1/system/tenants/cors

Method: POST

Field Data Type Mandatory Description Validation
domain String Y

Request origin domain.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”
context String Y

Request API context.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”

POST /admin/api/v1/systems/tenants/cors

{

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
400 2003 Domain is required. N/A
400 2004 Context is required. N/A
500 2005 Internal server error. N/A

{

"message": "Something went wrong",

"errorCode": 2005

}

System level: Get CORS

URL: /admin/api/v1/system/tenants/cors

Method: GET

Authentication: Super admin

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
500 2005 Internal server error. N/A

{

"message": "Something went wrong",

"errorCode": 2005

}

System level: Update CORS

URL: /admin/api/v1/tenants/cors/{corsId}syst

Method: PUT

Authentication: Super admin

Field Data Type Mandatory Description Validation
corsId int Y

CORS identifier.

Check if CORS exists in database.
Request Body
Field Data Type Mandatory Description Validation
domain String Y

Request origin domain.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”
context String Y

Request API context.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”

PUT /admin/api/v1/systems/tenants/cors/{corsId}

{

"domain": "new.outlook.vidyocloud.com",

"context": "/api/admin/v1"

}

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2002 CORS doesn’t exist. N/A
400 2003 Domain is required. N/A
400 2004 Context is required. N/A
500 2005 Internal sever error. N/A

{

"errors": [{

"errorCode": 2003,

"message": "Domain is required"

},

{

"errorCode": 2004,

"message": "Context is required"

}]

}

System level: Delete CORS

URL: /admin/api/v1/system/tenants/cors/{corsId}

Method: DELETE

Authentication: Super admin

Field Data Type Mandatory Description Validation
corsId int Y

CORS identifier.

Check if CORS exists in database.
Response body

204 No Content

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2002 CORS doesn’t exist N/A
500 2005 Internal sever error. N/A

Tenant Level: Add CORS

URL: /admin/api/v1/tenants/{tenantId}/cors

Method: POST

Authentication: Super admin, Tenant admin

Field Data Type Mandatory Description Validation
tenantId int Y

Tenant identifier.

Check if tenant exists in database.
Request Body
Field Data Type Mandatory Description Validation
domain String Y

Request origin domain.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”
context String Y

Request API context.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”

POST /admin/api/v1/tenants/{tenantId}/cors

{

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2001 Tenant doesn’t exist. N/A
400 2003 Domain is required. N/A
400 2004 Context is required. N/A
500 2005 Internal sever error. N/A

{

"message": "Tenant doesn't exist",

"errorCode": 2001

}

Tenant level: Get CORS

URL: /admin/api/v1/tenants/{tenantId}/cors

Method: PUT

Authentication: Super admin, Tenant admin

Field Data Type Mandatory Description Validation
tenantId int Y

Tenant identifier.

Check if tenant exists in database.

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "outlook.vidyocloud.com",

"context": "/api/admin"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2001 Tenant doesn’t exist. N/A
500 2005 Internal sever error. N/A

{

"message": "Tenant doesn't exist",

"errorCode": 2001

}

Tenant level: Update CORS

URL: /admin/api/v1/tenants/{tenantId}/cors/{corsId}

Method: PUT

Authentication: Super admin, Tenant admin

Field Data Type Mandatory Description Validation
tenantId int Y

Tenant identifier.

Check if tenant exists in database.
corsId int Y

CORS identifier.

Check if CORS exists in database.
Request Body
Field Data Type Mandatory Description Validation
domain String Y

Request origin domain.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”
context String Y

Request API context.

Can’t be null or empty. Should not contain white spaces, special characters except “.”, “-“, ”*”

PUT /admin/api/v1/tenants/{tenantId}/cors/{corsId}

{

"domain": "new.outlook.vidyocloud.com",

"context": "/api/admin/v1"

}

Response Body

Field Data Type Mandatory Description
id int Y CORS identifier.
domain String Y Request origin domain.
context String Y Request API context.

{

"id": "1",

"domain": "new.outlook.vidyocloud.com",

"context": "/api/admin/v1"

}

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2001 Tenant doesn’t exist. N/A
404 2002 CORS doesn’t exist. N/A
400 2003 Domain is required. N/A
400 2004 Context is required. N/A
500 2005 Internal sever error. N/A

{

"errors": [{

"errorCode": 2003,

"message": "Domain is required"

},

{

"errorCode": 2004,

"message": "Context is required"

}]

}

Tenant level: Delete CORS

URL: /admin/api/v1/tenants/{tenantId}/cors/{corsId}

Method: DELETE

Authentication: Super admin, Tenant admin

Field Data Type Mandatory Description Validation
tenantId int Y

Tenant identifier.

Check if tenant exists in database.
corsId int Y

CORS identifier.

Check if CORS exists in database.
Response Body

204 No Content

HTTP status codes, Error codes and messages:
HTTP Response Code Error Code Error Message Scenario
404 2001 Tenant doesn’t exist. N/A
404 2002 CORS doesn’t exist. N/A
500 2005 Internal sever error. N/A

{

"message": "CORS doesn't exist",

"errorCode": 2001

}