Endpoint: /sites
Returns and update site(s) settings.
-
GET
-
POST
Method & URL
GET https://[server URL]:[port]/admin/v2/sites
GET Body Sample
Copy
### GET SITE ###
# @name siteList
GET https://{{host}}/admin/v2/sites HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
PATCH PowerShell Sample
Copy
{ "data": [ { "type": "site", "id": "892b16dc-24a8-473f-a74e-c597b824c879",
"attributes": { "name": "MySite" }, "links": { "self":
"admin/v2/sites/892b16dc-24a8-473f-a74e-c597b824c879", "metrics":
"admin/v2/sites/892b16dc-24a8-473f-a74e-c597b824c879/metrics" } },
{ "type": "site", "id": "5f99540a-da95-41c4-8b3c-d423848bdd46",
"attributes": { "name": "MySite2" },
"links": { "self": "admin/v2/sites/5f99540a-da95-41c4-8b3c-d423848bdd46",
"metrics": "admin/v2/sites/5f99540a-da95-41c4-8b3c-d423848bdd46/metrics" } } ],
"links": { "self": "admin/v2/sites" } }
GET PowerShell Sample
Copy
# Get all sites
Write-Output "Site"
Write-Output "----"
$siteList = Invoke-RestMethod -Uri "$baseURL/v2/sites"
-Method 'GET' -Headers $authHeader
Write-Output $siteList | ConvertTo-Json
foreach ($site in $siteList.data)
{
Write-Output ("Site $($site.id): $($site.attributes.name)")
}
$siteID = $siteList.data[0].id
Method & URL
POST https://[server URL]:[port]/admin/v2/sites
POST Body Sample
Copy
#POST Create a new Site
POST https://{{host}}/admin/v2/sites HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
{
"data": {
"type": "site",
"attributes": {
"pciComplianceEnabled": true,
"siteLabel": "MySite5",
"siteRootFolder": "C:\\InetPub\\EFTRoot\\MySite\\",
"createUnixStyleSubFolders": true,
"createFoldersForNewUsers": true
}
}
}
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).
POST PowerShell Sample
Copy
####Added 2/01/2020
#POST Site/ (Create a new Site)
Write-Output "POST Site (Create a new Site)"
Write-Output "-----"
$update =
'{
"data": {
"type": "site",
"attributes": {
"pciComplianceEnabled": true,
"siteLabel": "MySite6",
"siteRootFolder": "C:\\InetPub\\EFTRoot\\MySite\\",
"createUnixStyleSubFolders": true,
"createFoldersForNewUsers": true
}
}
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 10
$patchReturn = Invoke-RestMethod -Uri "$baseURL/v2/sites"
-Method 'POST' -Headers $authHeader -Body $update