Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 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!

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
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

76 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you