Skip to main content

Update specific fence

Available since 2021 Update 6

tip

You can try out this workflow at REST API Playground.

Learn more about MicroStrategy REST API Playground here.

You want to update the nodes reserved by user fence name administrator_user_fence having id YWRtaW5pc3RyYXRvcl91c2VyX2ZlbmNl, which is configured for Administrator user/usergroups.

The updated node is 296739laio3use1.

DssXmlPrivilegesConfigureServerBasic and DssXmlPrivilegesUseClusterMonitor privileges are required to update an existing user fence.

info

Obtain the authorization token needed to execute the request using POST /api/auth/login.

Update a specific fence

Endpoint: PATCH /api/v2/iserver/fences/{id}.

Sample Request Header:

"accept": "application/json"
"X-MSTR-AuthToken": "g97nfc2l7icgsb37vjdh4b6gcu"

Sample Request Body:

info

A patch that tries to pass an empty user and usergroup for a user fence, or a patch with an empty node list for either fence types, will not be allowed.

  • User Fence

Valid Paths:  /nodes, /users, /usergroups, /rank, /projects.

Valid Operations: replace

  • Workload Fence

Valid Paths:  /nodes, /rank, /projects.

Valid Operations: replace

{
"operationList": [
{
"op": "replace",
"path": "/nodes",
"value": ["env-296739laio3use1"]
}
]
}

Sample Curl:

curl -X PATCH \
'https://demo.microstrategy.com/MicroStrategyLibrary/api/v2/iserver/fences/YWRtaW5pc3RyYXRvcl91c2VyX2ZlbmNl' \
-H 'accept: application/json' \
-H 'X-MSTR-AuthToken: g97nfc2l7icgsb37vjdh4b6gcu' \
-H 'Content-Type: application/json' \
-d '{
"operationList": [
{
"op": "replace",
"path": "/nodes",
"value": ["env-296739laio3use1"]
}
]
}'

Sample Response Body:

info

users and usergroups can be configured only for user fence, therefore the response body for workload fence should contain empty users and usergroups fields.

You can view the detailed information of updated administrator_user_fence user fence in the body of the response. The detailed information includes rank, name, type, reserved nodes, configured users, usergroups and projects.

{
"rank": 1,
"name": "administrator_user_fence",
"type": "user_fence",
"nodes": ["296739laio3use1"],
"users": [
{
"id": "54F3D26011D2896560009A8E67019608",
"name": "Administrator"
}
],
"usergroups": [
{
"id": "E96685CD4E60068559F7DFAC7C2AA851",
"name": "Administrator"
}
],
"projects": [
{
"id": "B7CA92F04B9FAE8D941C3E9B7E0CD754",
"name": "MicroStrategy Tutorials"
}
],
"id": "YWRtaW5pc3RyYXRvcl91c2VyX2ZlbmNl"
}

Response Code: 200 (The given fence is updated successfully.)