SMTP Connections APIs

This section includes SMTP connection APIs.

Create SMTP connection

curl -k -X POST -H "Authorization: Bearer ${CAM_BEARER_TOKEN}" -H "Content-Type: application/json" -H "Accept: application/json" -d @cc_create.json "https://${CAM_HOST}:${CAM_PORT}/cam/api/v1/smtpconnections?tenantId=${CAM_TENANT_ID}&ace_orgGuid=${ICP_TEAM}

POST method

Example request body:

cc_create.json

{
    "name": "SECONDARY",
    "connection_parameters": [{
        "name": "hostname",
        "value": "test"
    }, {
        "name": "port",
        "value": 25
    }, {
        "name": "username",
        "value": "test"
    }, {
        "name": "password",
        "value": "test"
    }]
}

Modify SMTP connection

curl -X POST \
 'https://{{CAM_HOST}}:${CAM_PORT}/cam/composer/api/v1/smtpconnections/patchConnectionParametersById?ace_orgGuid=all&cloudOE_spaceGuid={{NAMESPACE}}&tenantId={{CAM_TENANT_ID}}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "id":"{{SMTPCONNECTION_ID}}",
        "connection_parameters":[
           {"name":"port","value": 587},
           {"name":"password","value":"my-new-password"}
         ]
      }'

POST method

The patchConnectionParameterById is used to update some of the parameters in the existing SMTP Connection record. Both patchConnectionParameterById and connection_parameters are mandatory.

Test SMTP connection

Run this API to test SMTP connection parameters before you create or save a connection.

curl -X POST \
  'https://{{CAM_HOST}}:${CAM_PORT}/cam/composer/api/v1/smtpconnections/testEmail?ace_orgGuid=all&tenantId={{CAM_TENANT_ID}}' \
  -H 'Authorization: Bearer {{CAM_BEARER_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "to":"{{SEND-TEST-EMAIL-TO}}",
    "conn_params":[
        {"name":"hostname","value":"({SMTP_HOST}}"},
        {"name":"port","value": "{{SMTP_PORT}}" },
        {"name":"username","value":"{{USERNAME}}"},
        {"name":"password","value":"{{PASSWORD}}"}
    ]
}'

POST method

The /testEmailByID is similar to /testEmail but it uses persisted parameters from a particular record. Optionally, you can send conn_params argument whenever you want to use some parameters with changed values.

POST method

curl -X POST \
    'https://{{CAM_HOST}}:${CAM_PORT}/cam/composer/api/v1/smtpconnections/testEmailById?ace_orgGuid=all&cloudOE_spaceGuid={{NAMESPACE}}&tenantId={{CAM_TENANT_ID}}' \
    -H 'Content-Type: application/json' \
    -H 'cache-control: no-cache' \
    -d '{
    "id":"{{SMTPCONNECTION_ID}}",
        "to":"my-test-email@test.xyz.net",
        "conn_params":[
           {"name":"port","value": 587},
           {"name":"password","value":"my-new-password"}
       ]
     }'

Where,

Get list of all SMTP connections

GET  all SMTPConnection : curl -k -X GET -H "Authorization: Bearer ${CAM_BEARER_TOKEN}" "https://${CAM_HOST}:${CAM_PORT}/cam/api/v1/smtpconnections?tenantId=${CAM_TENANT_ID}&ace_orgGuid=${ICP_TEAM}

GET method

Get list of SMTP connections by ID

curl -k -X GET -H "Authorization: Bearer ${CAM_BEARER_TOKEN}" "https://${CAM_HOST}:${CAM_PORT}/cam/api/v1/smtpconnections/<connection-id>?tenantId=${CAM_TENANT_ID}&ace_orgGuid=${ICP_TEAM}

GET method

Delete SMTP connection

curl -k -X DELETE -H "Authorization: Bearer ${CAM_BEARER_TOKEN}" "https://${CAM_HOST}:${CAM_PORT}/cam/api/v1/smtpconnections/<connection-id>?tenantId=${CAM_TENANT_ID}&ace_orgGuid=${ICP_TEAM}

DELETE Method