Endpoint: /sites/{siteId}/sms
Returns and updates the SMS configuration for the site.
-
GET
-
POST
Method & URL
GET https://[server URL]:[port]/admin/v2/sites/{siteId}/sms
GET Body Sample
Copy
### GET SMS Configuration####
GET https://{{host}}/admin/v2/sites/{{Siteid}}/sms HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
GET Response Body Sample
Copy
{
"data": [
{
"id": "Twilio Generic",
"type": "smsSettings",
"attributes": {
"serviceType": "twilioGeneric",
"services": {
"accountSid": "xxxxxxx ...",
"authToken": "xxxxx ....",
"twilioNumber": "+1210...",
"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": ""
}
}
}
],
"links": {
"self": "/admin/v2/sites/0de7387f-1506-427d-b997-e18bcdb8cbae/sms"
GET PowerShell Sample
Copy
####Added 2/08/2022 ###
###GET SMS Settings for Site###
Write-Output "GET SMS Settings for Site"
Write-Output "----"
#$siteID = "Enter site ID"
$smsList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/sms" -Method 'GET' -Headers $authHeader
Write-Output $smsList | ConvertTo-Json -Depth 25
Method & URL
POST https://[server URL]:[port]/admin/v2/sites/{siteId}/sms
POST Body Sample
Copy
### POST add an SMS profile###
POST https://{{host}}/admin/v2/sites/{{Siteid}}/sms HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
{
"data": {
"attributes": {
"name": "Test Post SMS",
"serviceType": "genericSmsProviderProfile",
"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,
"type": "192.168.100.100",
"hostName": "testproxy",
"port": 1443,
"userName": "",
"password": ""
}
}
}
}
POST Response Body Sample
The response will return the same response as the GET request, however, it will now include the updated POST request(s).
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/smsTest Post SMS"
}
}
}
}
POST PowerShell Sample
Copy
### POST add a new SMS profile ###
### User must obtain the SiteID from Get Sites
Write-Output "add a new SMS profile "
Write-Output "----------------------"
$update =
'{
"data": {
"attributes": {
"name": "PowerShell Example",
"serviceType": "genericSmsProviderProfile",
"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,
"type": "192.168.100.100",
"hostName": "testproxy",
"port": 1443,
"userName": "TestUser",
"password": "example"
}
}
}
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 25
$patchReturn = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/sms"
-Method 'POST' -Headers $authHeader -Body $update