Skip to main content

Access Control (REST) API - SMTP Settings

This section includes REST APIs for working with Access Control SMTP Setting tasks.

Get All SMTP Settings - GET /SMTPSettings

Get details of all SMTP settings.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. GET /SMTPSettings and get details of all SMTP settings

  2. https://checkmarx.atlassian.net/wiki/spaces/CCD/pages/712999010 and update SMTP settings

URL

/cxrestapi/auth/SMTPSettings

Method:

GET

Media Type (header):

Authorization: Bearer <access token value>

Accept: application/json;v=1.0

Parameters

None

Success Response:

Code: 200 Success

Error Response:

Code: 401 Unauthorized

Code: 403 Forbidden

Sample Response:

[
  {
    "id": 1,
    "host": "pod55017.outlook.com",
    "port": 521,
    "encryptionType": "Tls",
    "fromAddress": "noreply@check.org",
    "useDefaultCredentials": false,
    "username": "noreply@check.org"
  }
]

Notes:

Retrieves SMTP setting details. If the request fails, it returns an error response.

Create SMTP Settings - POST /SMTPSettings

Create new SMTP settings.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. POST /SMTPSettings and create new SMTP settings

  2. POST /SMTPSettings/testconnection and test SMTP connection

URL

/cxrestapi/auth/SMTPSettings

Method:

POST

Media Type (header):

Authorization: Bearer <access token value>

Content-Type: application/json;v=1.0

Parameters

createSmtpSettingsModel=[body]: Specifies the SMTP setting details

password=[string] - Sender password

host=[string] - SMTP server host

port=[integer] - Port for sending emails

encryptionType=[string] - SMTP encryption type (SSL,TLS or None)

fromAddress=[string] - From field when sending emails

useDefaultCredentials=[string] - Whether SMTP communication is done via SSL (true/false)

username=[string] - Sender user name

Success Response:

Code: 201 Success

Error Response:

Code: 400 Bad Request

Code: 401 Unauthorized

Code: 403 Forbidden

Sample Response:

no content 

Notes:

Returns the location of the created SMTP settings in the response header. If the request fails, it returns an error response.

Get SMTP Settings by Id - GET /SMTPSettings/{id}

Get details of SMTP settings according to SMTP Settings Id.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. GET /SMTPSettings/{id} and get details of SMTP settings

  2. PUT /SMTPSettings/{id} and update SMTP settings

URL

/cxrestapi/auth/SMTPSettings/{id}

Method:

GET

Media Type (header):

Authorization: Bearer <access token value>

Accept: application/json;v=1.0

Parameters

Required:

id=[integer] - Unique Id of the SMTP settings

Success Response:

Code: 200 Success

Error Response:

Code: 400 Bad Request

Code: 401 Unauthorized

Code: 403 Forbidden

Code: 404 Not Found

Sample Response:

[
  {
    "id": 1,
    "host": "pod55017.outlook.com",
    "port": 521,
    "encryptionType": "Tls",
    "fromAddress": "noreply@check.org",
    "useDefaultCredentials": false,
    "username": "noreply@check.org"
  }
]

Notes:

Retrieves details of the SMTP settings according to the specified SMTP settings Id. If the request fails, it returns an error response.

Update SMTP settings - PUT /SMTPSettings/{id}

Update SMTP settings according to SMTP Settings Id.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. PUT /SMTPSettings/{id} and update the SMTP settings

  2. POST /SMTPSettings/testconnection and test SMTP connection

URL

/cxrestapi/auth/SMTPSettings/{id}

Method:

PUT

Media Type (header):

Authorization: Bearer <access token value>

Content-Type: application/json;v=1.0

Parameters

Required:

id=[integer] - Unique Id of the SMTP settings

updateSMTPSettingsModel=[body]: Specifies the SMTP settings to update

password=[string] - Sender password

host=[string] - SMTP server host

port=[integer] - Port for sending emails

encryptionType=[string] - SMTP encryption type (SSL,TLS or None)

fromAddress=[string] - From field when sending emails

useDefaultCredentials=[string] - Whether SMTP communication is done via SSL (true/false)

username=[string] - Sender user name

Success Response:

Code: 204 Success

Error Response:

Code: 400 Bad Request

Code: 401 Unauthorized

Code: 403 Forbidden

Code: 404 Not Found

Sample Response:

no content

Notes:

Updates the SMTP settings according to the defined parameters. Once the request is successful, it does not return any content. If the request fails, it returns an error response.

Delete SMTP Settings – DELETE /SMTPSettings/{id}

Delete SMTP settings according to SMTP Settings Id.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. GET /SMTPSettings and get details of all SMTP settings

  2. DELETE /SMTPSettings/{id} and delete SMTP settings

URL

/cxrestapi/auth/SMTPSettings/{id}

Method:

DELETE

Media Type (header):

Authorization: Bearer <access token value>

Content-Type: application/json;v=1.0

Parameters

Required:

id=[integer] - Unique Id of the SMTP settings

Success Response:

Code: 204 Success

Error Response:

Code: 400 Bad Request

Code: 401 Unauthorized

Code: 403 Forbidden

Code: 404 Not Found

Sample Response:

no content

Notes:

Deletes the SMTP settings according to SMTP settings Id. Once the request is successful, it does not return any content. If the request fails, it returns an error response.

Test SMTP Connection – POST /SMTPSettings/testconnection

Test SMTP connection.

Notice

The ‘Manage System Settings’ permission is required to execute this API.

Usage:

  1. POST /SMTPSettings and create new SMTP settings

  2. POST /SMTPSettings/testconnection and test SMTP connection

URL

/cxrestapi/auth/SMTPSettings/testconnection

Method:

POST

Media Type (header):

Authorization: Bearer <access token value>

Content-Type: application/json;v=1.0

Parameters

testConnectionModel=[body]: Specifies the SMTP settings to test

receiverEmail=[string] - To field when receiving emails

password=[string] – Senders password

host=[string] - SMTP Server host

port=[integer] - port for sending emails

encryptionType=[string] - SMTP encryption type (SSL,TLS or None)

fromAddress=[string] - From field when sending emails

useDefaultCredentials=[string] – Whether SMTP communication is done via SSL (true/false)

username=[string] - Senders user name

Success Response:

Code: 200 Success

Error Response:

Code: 400 Bad Request

Code: 401 Unauthorized

Code: 403 Forbidden

Code: 404 Not Found

Sample Response:

no content

Notes:

Tests the SMTP connection. If the request fails, it returns an error response.