Set User Rank via API
We recently updated our ranking system and use some custom ranking formulas for our new ranks. However, we have some longtime users who didn't meet all of our new criteria so they were "demoted" to a lower rank. We're hoping to grandfather these users into their old rank, but it seems like there's not any way to do that. There's no way I've found in the settings or rank settings and I've tried with a few users via the API with no luck. Does anyone know of a way to do this for a list of users that we want to manually change their rank even if they don't meet all the formula requirements? Or will the formula requirements keep us from changing their rank manually?
Here's the code I'm using to try to change the rank manually. I get a success message when I run this, but the rank doesn't change:
const options = {
method: 'PUT',
headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'user',
rank: {id: '9'}
}
})
};
fetch('https://community.url.com/api/2.0/users/user-id', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
(I've changed our url and user-id for privacy, but I'm using the correct values in the code I'm running)
I think Stan has the right idea. As Stan pointed out, you can't directly set ranks via the API or otherwise; it's all managed through the rank structure itself, so the rank structure would need to be built to account for this.
How easy or hard this is will likely depend on how your rank formulas are constructed:
- If your formula is essentially a series of AND evaluations (e.g. posts > 10 && net_kudos_events_received > 5 && tagging_tag_count > 3 && ...) then you'll probably need some kind of special case added in as an OR logic, or as Stan suggested have separate parallel ranks for the legacy users based on role or some other criteria unique to these users.
- If your formula is doing some kind of math calculation to total some kind of "points" system (e.g. posts*1.4 + net_kudos_events_received*3 +tagging_tag_count*0.7 > 24), then one option would be to use the Bonus Points ("arbitrary_points" in your rank formula) to give these legacy users a boost to meet some minimum ranking threshold.