User manual
Back to table of contents

Users

Checking authentication

To check if authentication token is valid, send GET request to /api/v1/whoami.json.

Response

{
  "user": {
    "id": 111,
    "name": "vasya",
    "display_name": "Vasily Pupking",
    "status": "public",
    "description": "#v_for_vasily",
    "url": "/vasya"
  }
}

Curl command line:

curl -n -X GET https://mokum.place/api/v1/whoami.json \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Token: $MOKUM_API_TOKEN"

Hiding users

To hide user named ‘kevin’, send POST request to /api/v1/users/kevin/hide.

Response

{
  "hidden": true
}

Curl command line:

curl -n -X POST https://mokum.place/api/v1/users/$USERNAME/hide.json \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Token: $MOKUM_API_TOKEN"

Unhiding users

To unhide user named ‘kevin’, send DELETE request to /api/v1/users/kevin/hide.

Response

{
  "unhidden": true
}

Curl command line:

curl -n -X DELETE https://mokum.place/api/v1/users/$USERNAME/hide.json \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Token: $MOKUM_API_TOKEN"

Blocking users

To block user named ‘mallory’, send POST request to /api/v1/users/mallory/ban.

Response

{
  "banned": true
}

Curl command line:

curl -n -X POST https://mokum.place/api/v1/users/$USERNAME/ban.json \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Token: $MOKUM_API_TOKEN"

Unblocking users

To unblock user named ‘mallory’, send DELETE request to /api/v1/users/mallory/ban.

Response

{
  "unbanned": true
}

Curl command line:

curl -n -X DELETE https://mokum.place/api/v1/users/$USERNAME/ban.json \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Token: $MOKUM_API_TOKEN"