Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-53590

Mount point /rest/questions/1.0/answer does not return the expected dataset

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 6.4.1
    • None

    Description

      Summary

      Fetching data through the /answers REST resource does not return the expected results.

      Environment

      • Tested with Questions for Confluence Plugin version 2.4.19

      Steps to Reproduce

      1. Install Questions for Confluence plugin
      2. Include some sample questions and answers
      3. Run the follwoing command to retrieve answers data
        curl -u <username>:<pass> -X GET 'http://bandreeti/confluence/rest/questions/1.0/answer?limit=10&start=0&username=<name>'
        

      Expected Results

      The JSON dataset of the following document is returned:

      Actual Results

      The following dataset is returned:

      [{"id":8912944,"questionId":8912942,"author":{"name":"bandreeti","fullName":"Bernardo Andreeti","avatarDownloadPath":"/images/icons/profilepics/default.png","email":"bandreeti@bandreeti.com","userKey":"40288a045d190d23015d1957135d0001"},"dateAnswered":1506704076867,"friendlyDateAnswered":"less than a minute ago","votes":{"up":0,"down":1,"total":-1,"upVoted":false,"downVoted":false},"accepted":false,"space":{"spaceKey":"TEST","spaceName":"Test"},"url":"/display/TEST/questions/8912942/answers/8912944","question":{"id":8912942,"title":"another question","url":"/display/TEST/questions/8912942/another-question","author":{"name":"bandreeti","fullName":"Bernardo Andreeti","avatarDownloadPath":"/images/icons/profilepics/default.png","email":"bandreeti@bandreeti.com","userKey":"40288a045d190d23015d1957135d0001"},"friendlyDateAsked":"less than a minute ago","dateAsked":1506704066677,"answersCount":0,"topics":[{"id":9240577,"idAsString":"9240577","name":"ciastes","url":"/questions/topics/9240577/ciastes","featured":false,"isWatching":false}],"votes":{"up":1,"down":0,"total":1,"upVoted":true,"downVoted":false},"space":{"spaceKey":"TEST","spaceName":"Test"},"isTrashed":false},"idAsString":"8912944"},{"id":8912938,"questionId":8912936,"author":{"name":"bandreeti","fullName":"Bernardo Andreeti","avatarDownloadPath":"/images/icons/profilepics/default.png","email":"bandreeti@bandreeti.com","userKey":"40288a045d190d23015d1957135d0001"},"dateAnswered":1506704031820,"friendlyDateAnswered":"a minute ago","votes":{"up":1,"down":0,"total":1,"upVoted":false,"downVoted":false},"accepted":true,"dateAccepted":1506704048089,"space":{"spaceKey":"TEST","spaceName":"Test"},"url":"/display/TEST/questions/8912936/answers/8912938","question":{"id":8912936,"title":"this is a question","url":"/display/TEST/questions/8912936/this-is-a-question","author":{"name":"bandreeti","fullName":"Bernardo Andreeti","avatarDownloadPath":"/images/icons/profilepics/default.png","email":"bandreeti@bandreeti.com","userKey":"40288a045d190d23015d1957135d0001"},"friendlyDateAsked":"a minute ago","dateAsked":1506704026340,"answersCount":0,"topics":[{"id":6848513,"idAsString":"6848513","name":"bugs","url":"/questions/topics/6848513/bugs","featured":false,"isWatching":false}],"acceptedAnswerId":8912938,"votes":{"up":0,"down":0,"total":0,"upVoted":false,"downVoted":false},"space":{"spaceKey":"TEST","spaceName":"Test"},"isTrashed":false},"idAsString":"8912938"}]
      

      Notes

      We can see that the body and comments data as described in the mentioned document are not present in the response, even though the answers have comments added to them. This means we cannot retrieve the contents of the answers (body) nor the comments through this mount point

      Workaround

      Use the following mount point to retrieve answers data:

      /rest/questions/1.0/answer/{answerId}
      

      Notice that we need to specify the answer IDs with this call, so it may be necessary to create a script if all answers are needed.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bandreeti Bernardo Andreeti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: