Set user properties

Sets (creates, updates, deletes) user properties.

URL

POST https://api.dashly.app/v1/users/{id}/props

For {id} you can use:

  • Dashly ID
  • Your User ID (in case user with such ID does not exist, new user with such ID is created) (send with by_user_id=true)

Arguments

This method follows the general rules. Arguments are transmitted as GET or POST parameters.

Argument Description
auth_token Required. Authorization token (requires scope: user-write)
operations Required. The array of atomic operations (JSON-encoded) that will be performed on the properties of the user. Properties format
by_user_id Optional. Set to true in case User ID is used for access. Default:: false.

Answer

{
  "meta": {
    "status": 200,
    "affected_props": [],
    "ignored_operations": []
  },
  "data": {}
}

Answer will be empty. Affected_props meta field contains affected parameters’ names.

Ignored_operations meta field contains operations, which were not conducted (got empty value, or value was not changed by update_or_create).

Example

Set name “Maks” for user with dashlyId=8173131 (our ID):

curl -X POST \
  --data-urlencode "operations=[{"op": "update_or_create", "key": "$name", "value": "Maks"}]" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/users/8173131/props

Set name “Maks” for user with UserId=user-7216 (your ID):

curl -X POST \
  --data-urlencode "operations=[{"op": "update_or_create", "key": "$name", "value": "Maks"}]" \
  --data-urlencode "by_user_id=true" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/users/user-7216/props

Set property my-prop with Hello value and increase projects property by 3 for user with UserId=user-721 (your ID):

curl -X POST \
  --data-urlencode 'operations=[{"op": "update_or_create", "key": "my-prop", "value": "Hello"},{"op": "add", "key": "projects", "value": "3"}]' \
  --data-urlencode 'by_user_id=true' \
  --data-urlencode 'auth_token=XXX' \
  "https://api.dashly.app/v1/users/user-7216/props"