Endpoint: /sites/{siteId}/sms/{profileName}

Returns, updates and deletes the SMS configuration for specific profile.

  • GET

  • PATCH

  • DELETE

Method & URL

GET https://[server URL]:[port]/admin/v2/sites/{siteId}/sms/{profileName}

GET Body Sample

Copy
### GET SMS Configuration####
GET https://{{host}}/admin/v2/sites/{{Siteid}}/sms/{profileName} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

GET Response Body Sample

Copy
{
  "data": {
    "id": "Test Post SMS",
    "type": "smsSettings",
    "attributes": {
      "name": "Test Post SMS",
      "serviceType": "twilioGeneric",
      "services": {
        "accountSid": "AAAAAAAAAAAAAAAAAAAAAAe",
        "authToken": "0dddd0dddd0dddd0dddd",
        "twilioNumber": "+1210210210",
        "message": "Your passcode is: %Account_Session_OTP%",
        "postUrl": "https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages"
      },
      "proxy": {
        "enabled": true,
        "hostName": "testproxy",
        "password": "",
        "port": 1443,
        "type": 0,
        "userName": ""
      }
    }
  },
  "links": {
    "self": "/admin/v2/sites/0de7387f-1506-427d-b997-e18bcdb8cbae/sms/Test Post SMS"
  }
}

GET PowerShell Sample

Copy

####Added 2/08/2022 ### 
###GET specific profile SMS Configuration Details###
Write-Output "GET specific profile SMS Configuration Details"
Write-Output "----"
$profileName = "PowerShell Example"
$smsList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/sms/$profileName" -Method 'GET' -Headers $authHeader
Write-Output $smsList | ConvertTo-Json -Depth 25 

Method & URL

PATCH https://[server URL]:[port]/admin/v2/sites/{siteId}/sms/{profileName}

PATCH Body Sample

Copy
### PATCH SMS specific profile ###
PATCH https://{{host}}/admin/v2/sites/{{Siteid}}/sms/{{profileName}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

{
  "data": {
    "attributes": {
      "name": "",
      "serviceType": "genericSmsProviderProfile",
      "services": {
        "accountSid": "43243243214324234321FDGFDSG",
        "authToken": "1234567899",
        "twilioNumber": "210101010101",
        "message": "Your passcode is: %Account_Session_OTP%",
        "postUrl": "https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages"
      }
    }
  }
}

PATCH Response Body Sample

The response will return the same response as the GET request, however, it will now include the updated PATCH request(s).

Copy
{
  "data": {
    "id": "Test Post SMS",
    "type": "smsSettings",
    "attributes": {
      "name": "Test Post SMS",
      "serviceType": "twilioGeneric",
      "services": {
        "accountSid": "43243243214324234321FDGFDSG",
        "authToken": "1234567899",
        "twilioNumber": "210101010101",
        "message": "Your passcode is: %Account_Session_OTP%",
        "postUrl": "https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages"
      },
      "proxy": {
        "enabled": true,
        "hostName": "testproxy",
        "password": "",
        "port": 1443,
        "type": 0,
        "userName": ""
      }
    }
  },
  "links": {
    "self": "/admin/v2/sites/0de7387f-1506-427d-b997-e18bcdb8cbae/smsTest Post SMS"
  }
}
  "data": {
    "id": "Test Post SMS",
    "type": "smsSettings",
    "attributes": {
      "name": "Test Post SMS",
      "serviceType": "twilioGeneric",
      "services": {
        "accountSid": "43243243214324234321FDGFDSG",
        "authToken": "1234567899",
        "twilioNumber": "210101010101",
        "message": "Your passcode is: %Account_Session_OTP%",
        "postUrl": "https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages"
      },
      "proxy": {
        "enabled": true,
        "hostName": "testproxy",
        "password": "",
        "port": 1443,
        "type": 0,
        "userName": ""
      }
    }
  },
  "links": {
    "self": "/admin/v2/sites/0de7387f-1506-427d-b997-e18bcdb8cbae/smsTest Post SMS"
  }
}

PATCH PowerShell Sample

Copy
####Added 2/08/2022
### PATCH - Updates existing SMS profile ###
### User must obtain the SiteID from Get Sites
Write-Output "add a new SMS profile "
Write-Output "----------------------"
$profileName = "PowerShell Example"
$update = 
'{
  "data": {
    "attributes": {
      "name": "",
      "serviceType": "genericSmsProviderProfile",
      "services": {
        "accountSid": "43243243214324234321FDGFDSG",
        "authToken": "1234567899",
        "twilioNumber": "210101010101",
        "message": "Your passcode is: %Account_Session_OTP%",
        "postUrl": "https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages"
      }
    }
  }
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 25
$patchReturn = Invoke-RestMethod -Uri 
"$baseURL/v2/sites/$siteID/sms/$profileName" 
-Method 'PATCH' -Headers $authHeader -Body $update

Method & URL

DELETE https://[server URL]:[port]/admin/v2/sites/{siteId}/sms/{profileName}

DELETE Body Sample

Copy
### DELETE SMS specific profile###
DELETE https://{{host}}/admin/v2/sites/{{Siteid}}/sms/{{profileName}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

DELETE Response Body Sample

Copy
{ "data": [ { "id": "Twilio Generic", "type": "smsSettings", "attributes": { 
"serviceType": "twilioGeneric", "services": { "accountSid": "Aabdd54dgsb2e9357b03a", 
"authToken": "0dddd2e4357fac35f10132a8ff7949ec", "twilioNumber": "+12109414973", 
"message": "Your passcode is: %Account_Session_OTP%", "postUrl": 
"https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages" }, "proxy": { 
"enabled": true, "hostName": "", "password": "", "port": 8080, "type": 2, "userName": "" } } }, { 
"id": "Andres TEST", "type": "smsSettings", "attributes": { "serviceType": "twilioGeneric", 
"services": { "accountSid": "324423", "authToken": "54325432542352345", "twilioNumber": 
"213213132123", "message": "Your passcode is: %Account_Session_OTP%", "postUrl": 
"https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages" }, "proxy": { "enabled": false, 
"hostName": "", "password": "", "port": 8080, "type": 0, "userName": "" } } }, { "id": 
"PowerShell Example", "type": "smsSettings", "attributes": { "serviceType": "twilioGeneric", 
"services": { "accountSid": "43243243214324234321FDGFDSG", "authToken": "ABCDEFT1234567899", 
"twilioNumber": "210101010101", "message": "Your passcode is: %Account_Session_OTP%", "postUrl": 
"https://api.twilio.com/2010-04-01/Accounts/%SID%/Messages" }, "proxy": { "enabled": true, 
"hostName": "testproxy", "password": "ZXhhbXBsZQ==", "port": 1443, "type": 0, "userName": 
"TestUser" } } } ], "links": { "self": 
"/admin/v2/sites/0de7387f-1506-427d-b997-e18bcdb8cbae/sms" } }

DELETE PowerShell Sample

Copy
###### DELETE SMS specific profile######
Write-Output "### DELETE SMS specific profile###"
Write-Output "----"
$profileName = "PowerShell Example"
$smsList = Invoke-RestMethod -Uri 
"$baseURL/v2/sites/$siteID/sms/$profileName" -Method 'DELETE' 
-Headers $authHeader
Write-Output $smsList | ConvertTo-Json -Depth 25