REST API call to lock and unlock computer

Update! 3/21 5pm
We determined I have an issue in my API dev client. We got it working in PowerShell, and I’ll circle back with an update this week.

I have a business need to lock and unlock a computer through REST API. I have experience calling the REST API to gather computer & properties and to create actions for fixlets/tasks/baselines. I am confident the lock part could be completed by calling a Task/Fixlet, however, that would not work for unlock. Either way, I would prefer to learn the “native” API directly to the computer API endpoint.

Get current setting:

GET Response
<BESAPI xmlns:xsi="" xsi:noNamespaceSchemaLocation="BESAPI.xsd"> <ComputerSettings Resource=""> <Setting Resource=""> <Name>__LockState</Name> <Value>true</Value> </Setting> </ComputerSettings> </BESAPI>

Submit update to setting:
Post vs. Put:

  • Documentation suggests PUT could only be used to update the value if the setting is present.
  • Documentation suggests POST could be used to create and/or update the value if the setting is present.
    This makes me think POST makes the most sense to use from a code reusability standpoint to use with all properties going forward. Am I missing anything?

This is what I cannot figure out. What should I be sending in the body?

Note: I am using PowerShell.

Documentation links I am using:

We determined I have an issue in my API dev client. We got it working in PowerShell, and I’ll circle back with an update this week.

“Lock/Unlock” are Actions, from the view of the endpoint. I believe best approach is to take actions from the tasks in the BES Support site -

295 BES Client Setting: Lock Computer
296 BES Client Setting: Unlock Computer

These should use the XML for ‘SourcedFixletAction’. Because the Source Fixlets are in “BES Support”, the Unlock will run on locked machines (where a custom copy of the same task in a different site would not execute on the Locked computer)

Interesting. That is very good to know the lock tasks still work!

1 Like

Yes, the tasks in the BES Support site work on locked systems. You can also choose one Custom Site from which actions will still run on Locked systems, using the advanced deployment options in BESAdmin.

1 Like

Anyone know if it’s possible to:

  1. Customize the action TITLE when setting propteries?
    For example with taking action on a fixlet or baseline, you can add Test name
    I have tested placing this in the XML in a few places, no luck so far
  2. Set a stop time?
    Actions are created with open ended, which is not needed.
    Our alternative option1 right now is, to add additional workflow to check for “Completed” and stop.
    Our alternative option2 may be to just switch back applying the Master Site Fixlet per Jason

@DerrickD you can set the action title using the Title tag like in this snippet:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="" xsi:noNamespaceSchemaLocation="BES.xsd">
		<Title>This is the title of the action</Title>

Is that what you mean?

@DerrickD you can set the action stop time in the Settings block (which comes right after SuccessCriteria in the XML) using the HasEndTime and EndDateTimeLocalOffset tags like in this snippet:

			<PostActionBehavior Behavior="Nothing"></PostActionBehavior>

EndDateTimeLocalOffset is measured from the start time. Examples:
P1D = 1 day
PT2H = 2 hours

@DerrickD also I don’t think the sourced fixlet method supports changing the title, so you might be out of luck unlocking since you have to source that from BES Support…

There’s documentation for the Action REST resource (a little more detailed than the PDF) at

1 Like

Sort of, yes. I am gathering more experience around using the native computer settings API for this task, so seeing if I can include Title & Stop times there. I’ll try this shortly again.

If I go back to applying the fixlet/task in the Master site, then I am good with doing the time & title there.