2

I saw there are two fields in answer type.

One is accepted, introduced in v2.2 and needs private_info access.
While another one is is_accepted without these limits.

Can somebody give an explanation?

1 Answer 1

3

If the answer is the accepted answer, is_accepted is true and anyone can see it.

accepted is set to true only if the currently authenticated user is the one who has accepted the answer.


For instance, if I obtain an access_token with the private_info privilege and call:

/2.2/questions/30028657/answers?site=stackoverflow&key={YOUR APP KEY}&access_token={VALID TOKEN FOR THAT APP}&filter=!%294k-FmUi-xgG3sdSdPz*cQNNqR0A

I see:

"items":[
    {
        "owner":{
            "user_id":2435473,
            "display_name":"pankajparkar"
        },
        "accepted":false,
        "is_accepted":true,
        "score":2,
        "creation_date":1430738287,
        "answer_id":30028806,
        "question_id":30028657
    },
    {
        "owner":{
            "user_id":4494320,
            "display_name":"Mike"
        },
        "accepted":false,
        "is_accepted":false,
        "score":1,
        "creation_date":1430738255,
        "answer_id":30028794,
        "question_id":30028657
    },
    etc.

accepted is false, because I do not own that question.

On questions owned by the authenticated user, accepted == is_accepted for any answers to that question.

Note that you need to use a filter that returns accepted, as this is not present by default.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .