Updates user preferences and application settings for a specific user

PUT /api/users/{username}/preferences

Overview

Sets the avatar and default site of a named staff (back-office) user. Returns 204 No Content with no body. Unlike the endpoints under /api/users/preference/{preferenceId}, which only ever act on the user behind your own access token, this one takes the target user in the path — so use it when an administrator is configuring somebody else's account.

Read the request body table carefully: only details.avatarId and details.preferredSiteId are applied. The whole preferences object — favourites, bookingSheetFavourites, languageId, accessibilitySettings and system — is accepted by the API and then ignored. Sending it changes nothing and returns 204, which is indistinguishable from success. If you need to store those settings, use Creates or updates a user preference for the currently logged-in user, which genuinely saves key/value preferences — subject to its own limitation that it can only write for the caller's own account.

The details object is not optional in practice. Omitting it produces a 500, and supplying it with a blank avatarId produces a 400, so every call must carry an avatar even when all you are changing is the site.

The account must be fully set up for this endpoint or the call returns 404. On numeric-role tenants — those whose users' roleId values are numbers in Retrieves all administrative users configured in the system — this endpoint returns 404 for every account, including accounts that Retrieves detailed information for a specific administrative user returns quite happily. Set avatarId and preferredSiteId through Updates the details and settings for a specific administrative user instead if you hit that.

Endpoint

PUT {base_url}/api/users/{username}/preferences

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Path parameters

NameTypeRequiredDescription
usernamestringYesThe sign-in name of the account to configure, as returned in [].username by Retrieves all administrative users configured in the system. Matched exactly, and this — not id in the body — is the value used. On numeric-role tenants, and for any account that is not fully set up, the call fails with 404.

Request body

FieldTypeRequiredDescription
idstringNoIgnored. The account is identified solely by the username in the path; a mismatched or absent id has no effect and triggers no validation error.
preferencesobjectNoAccepted and ignored in full. None of the fields nested beneath it are read or stored by this endpoint, and sending them still returns 204.
preferences.favouritesstringNoIgnored — see preferences.
preferences.bookingSheetFavouritesarray of objectNoIgnored — see preferences. Booking-sheet favourites are saved under the preference name BookingSheetFavourite via Creates or updates a user preference for the currently logged-in user, which is the working route for this data.
preferences.bookingSheetFavourites[].idstringNoIgnored — see preferences.
preferences.bookingSheetFavourites[].descriptionstringNoIgnored — see preferences.
preferences.languageIdstringNoIgnored — see preferences.
preferences.accessibilitySettingsobjectNoIgnored — see preferences.
preferences.accessibilitySettings.zoomLevelinteger (int32)NoIgnored — see preferences.
preferences.systemobjectNoIgnored — see preferences.
preferences.system.receiptLayoutIdstringNoIgnored — see preferences.
preferences.system.hardwareProfileIdstringNoIgnored — see preferences.
detailsobjectYesThe only part of the request that is applied. Omitting it returns 500 rather than 400 — always send it.
details.avatarIdstringYesThe profile image the back office shows for this user. Blank or omitted fails with 400 and The avatar ID must be given a value, which makes it mandatory in practice — resend the account's current avatarId when you only mean to change the site. Not validated against any list of known images.
details.preferredSiteIdstringNoThe site this user works at by default. It must be a real site (400, The given preferred site doesn't exist.) and must belong to the site group already recorded on the account (400, The preferred site ID must be contained in the given site group.) — this endpoint cannot move a user between site groups, so change the group first with Updates the details and settings for a specific administrative user. Omitting it or sending an empty string leaves the current default site unchanged; there is no way to clear it here.

Sample request

cURL
curl -X PUT '{base_url}/api/users/{username}/preferences' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "preferences": {
    "favourites": "string",
    "bookingSheetFavourites": [
      {
        "id": "string",
        "description": "string"
      }
    ],
    "languageId": "string",
    "accessibilitySettings": {
      "zoomLevel": 1
    },
    "system": {
      "receiptLayoutId": "string",
      "hardwareProfileId": "string"
    }
  },
  "details": {
    "avatarId": "string",
    "preferredSiteId": "string"
  }
}'

Errors

StatusMeaningWhen
400Bad requestdetails.avatarId is missing or blank: The avatar ID must be given a value. Checked before the user is looked up, so this fires even for a username that does not exist.
400Bad requestdetails.preferredSiteId names a site that does not exist: The given preferred site doesn't exist.
400Bad requestdetails.preferredSiteId names a real site that is not in the site group already recorded on the account: The preferred site ID must be contained in the given site group.
404Not foundThe account does not exist, or is not fully set up: User {username} cannot be found when calling UpdateUserPreferences. Numeric-role tenants get this for every account.
500Internal server errordetails was omitted from the request body. Also returned when the change cannot be saved completely, or the account's record is no longer found at the moment of saving. Returned with no body.

This page as markdown · All pages · llms.txt