Crucible REST API: rest-service-fecru/user-prefs-v1 request body

Anthony Zepeda October 25, 2017

Hi,

I'm trying to set the watch email user preference using the REST API. It seems I can use the call documented here: https://docs.atlassian.com/fisheye-crucible/latest/wadl/fecru.html#rest-service-fecru:user-prefs-v1

However, the request representation in the docs is empty, so I don't know how to form the POST request.

From /rest-service/users-v1/user, I get the following XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<restUserProfileData>
<avatarUrl>https://host/avatar/user?s=48</avatarUrl>
<email>user@domain</email>
<mappedCommitters/>
<preferences>
<elements value="instant" key="watchMode"/>
<elements value="30" key="changesetsPerPage"/>
<elements value="UTF-8" key="uploadcharset"/>
<elements value="5" key="maxFilesPerChangeset"/>
<elements value="51235" key="ideConnectorPort"/>
<elements value="3" key="context"/>
<elements value="patch" key="uploadtype"/>
<elements value="8" key="tabWidth"/>
<elements value="html" key="emailFormat"/>
<elements value="true" key="enableIde"/>
<elements value="file" key="uploadmethod"/>
</preferences>
<timeZone>
<name>PST8PDT</name>
<rawOffset>-28800000</rawOffset>
</timeZone>
<userData>
<avatarUrl>https://host/avatar/user?s=48</avatarUrl>
<displayName>Last, First</displayName>
<userName>user</userName>
</userData>
</restUserProfileData>

So I've tried using the following JSON:

{
"elements" : [{
"key": "watchMode",
"value": "daily"
}]
}  

As well as a few others. These all fail, I get the following response:

{
"code": "UnrecognizedProperty",
"message": "Unrecognized field \"elements\" (Class com.atlassian.fecrurestplugin.common.RestUserPrefService$UserPref), not marked as ignorable\n at [Source: org.eclipse.jetty.server.HttpInput@1a6f2dc2; line: 2, column: 16] (through reference chain: com.atlassian.fecrurestplugin.common.UserPref[\"elements\"])"

Does anyone know the proper way to form this request? 

1 answer

1 accepted

0 votes
Answer accepted
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2018

Hi @Anthony Zepeda,

The https://docs.atlassian.com/fisheye-crucible/latest/wadl/fecru.html#rest-service-fecru:user-prefs-v1 REST API endpoint helps in setting various preferences. Including, for example, the "Highlight one in the Commit Graph tab. This can be achieved by setting the visualisation.highlight property.

 

There is no available endpoint that provides the ability to set the "Send Watch Emails" in the users' profiles. This can only be changed directly by the user in the profile section.

 

Thanks, Caterina - Atlassian 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events