Skip to main content

User blocking in the API

How to block a user via API?

Written by Petr Pech

Blocking a user is not configured in the uzivatel record, but through a separate endpoint at the server root — i.e., outside the address of a specific company.


Blocking and unblocking

POST /u/{přihlašovací jméno}.json

blocked=true

The same request using cURL:

curl -u uzivatel:heslo -k -X POST -d "blocked=true" \
"https://server:5434/u/jmeno.json"

The response confirms that the action was successful:

{"winstrom":{"success":"true","@version":"1.0","message":""}}

Unblocking is the same request with the value blocked=false.


Checking the current status

The user's status can be retrieved with a simple GET to the same address:

GET /u/{přihlašovací jméno}.json

In addition to blocked, the response also includes the user's type, their permissions, and whether two-factor authentication is enabled.

⚠️ The address contains the user's login name. A nonexistent name will return 404 and the message Uživatel … neexistuje. Also be careful not to block the account you use to log in to the API.


Related

Did this answer your question?