Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,502
Community Members
 
Community Events
184
Community Groups

Confluence Questions has an importbounties API, but no mention of bounties in any docs

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 21, 2016

What this just a legacy of the Answers -> Questions migrations? Seems odd to build in an exposed API for internal use case.

 

https://docs.atlassian.com/confluence-questions/rest/resource_ImportResource.html#path__import_bounties.html

1 answer

1 accepted

2 votes
Answer accepted
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 21, 2016

Hey Eddie,

Yes, this was built specifically for the migration of Answers to Confluence Questions. The API is undoubtedly not supported since the "Bounties" feature in Confluence Questions does not yet exist beyond the schema to persist the information.

If you want to play around with it, the expected input looks something like this (python script from the initial migration):

import json
import requests
from datetime import datetime
 
def award_bounty_request(on_question, to_user, amount, from_user, for_answer=None):
    """
    Awards a bounty to a user in Confluence. The `on_question` (ID of the related question), `to_user` (Username of the user receiving the bounty,)
    `from_user` (Username of the user sacrificing the bounty) and `amount` parameters are required.

    """
    now = datetime.now().isoformat()
    payload = {
        "questionId": on_question,
        "awarder": from_user,
        "creator": from_user,
        "awardee": to_user,
        "points": amount,
        "creationDate": now,
        "dateAwarded": now
    }

    if from_user:
        payload["awarder"] = from_user

    if for_answer:
        payload["answerId"] = for_answer

    r = s.post(confluence_url + "/rest/questions/1.0/import/bounties", headers={"Content-type": "application/json"}, data=json.dumps(payload), timeout=60)
    if r.status_code == 200:
        # Success
        return True, r.text

    return False, r.text

# Usage
award_bounty_response = award_bounty_request(on_question=karma_question_id, to_user=username, from_user=bounty_username, amount=reputation_delta)

                    if award_bounty_response[0]:
                        # Succeeded!
                        save_karma(karma_user.id)
                        karma_stats.create_one()
                        logging.debug(u"SAVE: Successfully applied %s reputation to User %s: %s <%s>" % (reputation_delta, karma_user.id, karma_user.username, karma_user.email))

                    else:
                        # Failed :-(
                        karma_stats.fail_one()
                        logging.debug(u"ERROR: Failed to apply %s reputation for User %s: %s <%s>" % (reputation_delta, karma_user.id, karma_user.username, karma_user.email))
                        logging.debug(get_reputation_response[1])

 

Hope this helps!

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 21, 2016

Thank you! Yes.  I guess the implied answer is that I could create bounties, but they would not be reflected anywhere in the UI.  It seems playing with the REST API Browser (RAB) that I can't create potential bounties (without awardee and dateAwarded) - is that true?

 

Context - we are migrating from Jive to Confluence and I wanted to use bounties to encourage unanswered questions to be answered.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events