UserPreferences

Linked Properties

Link Description Type Constraints Supported operations
self This UserPreferences UserPreferences not null READ
user The user that this preference belongs to User not null READ

Local Properties

Property Description Type Constraints Supported operations
hideMail Hide mail address from other users Boolean READ / WRITE
timeZone Current selected time zone String READ / WRITE
commentSortDescending Sort comments in descending order Boolean READ / WRITE
warnOnLeavingUnsaved Issue warning when leaving a page with unsaved text Boolean READ / WRITE
accessibilityMode Enable accessibility mode Boolean READ / WRITE

UserPreferences 

Show my preferences
/api/v3/my_preferences
  • Response  200
  • Headers
    Content-Type: application/hal+json
    Body
    {
        "_type" : "UserPreferences",
        "_links" : {
            "self" : {
                "href" : "/api/v3/my_preferences",
            },
            "user": {
                "href": "/api/v3/users/1",
                "title": "John Sheppard"
            }
        },
        "hideMail" : false,
        "timeZone" : "Europe/Berlin",
        "commentSortDescending" : true,
        "warnOnLeavingUnsaved" : true,
        "accessibilityMode" : false
    }
  • Response  401
  • Returned if no user is currently authenticated

    Headers
    Content-Type: application/hal+json
    Body
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:Unauthenticated",
      "message": "You need to be authenticated to access this resource."
    }
Update UserPreferences
/api/v3/my_preferences

When calling this endpoint the client provides a single object, containing the properties that it wants to change, in the body.

  • Request
  • Headers
    Content-Type: application/json
    Body
    {
      "accessibilityMode": true,
      "timeZone": "Europe/Paris"
    }
  • Response  200
  • Headers
    Content-Type: application/hal+json
    Body
    {
        "_type" : "UserPreferences",
        "_links" : {
            "self" : {
                "href" : "/api/v3/my_preferences",
            },
            "user": {
                "href": "/api/v3/users/1",
                "title": "John Sheppard"
            }
        },
        "hideMail" : false,
        "timeZone" : "Europe/Berlin",
        "commentSortDescending" : true,
        "warnOnLeavingUnsaved" : true,
        "accessibilityMode" : false
    }
  • Response  400
  • Occurs when the client did not send a valid JSON object in the request body.

    Headers
    Content-Type: application/hal+json
    Body
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
      "message": "The request body was not a single JSON object."
    }
  • Response  401
  • Returned if no user is currently authenticated

    Headers
    Content-Type: application/hal+json
    Body
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:Unauthenticated",
      "message": "You need to be authenticated to access this resource."
    }
  • Response  422
  • Returned if the update contains invalid properties. Reasons are:

    • Specifying an invalid type

    • Using an unknown time zone

    Headers
    Content-Type: application/hal+json
    Body
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Time zone is not set to one of the allowed values."
    }