2

My intended behavior of my app is to navigate the user the the question page when an inbox item gets clicked.

For example, when the API return a link like this https://stackapps.com/questions/8515/after-which-time-span-can-my-vote-no-longer-change/8517#8517 I navigate in my app to questions/8515/after-which-time-span-can-my-vote-no-longer-change/8517#8517 and everything works fine.
Here I can simply use the question id 8515 to navigate to the question and 8517#8517 to highlight the answer.

To come to my problem now. When I use the inbox route I'm interested in two item_types :

  • new_answer
  • comment

Both contain a link that for me is hard to use, because they don't contain the question id. e.g.:

  • https://stackapps.com/a/8517?noredirect=1 (item_type: new_answer)
  • https://stackapps.com/posts/comments/17601?noredirect=1 (item_type: comment)

Is there any way to figure out the question id of the answer / comment without making another request like answers by ids?

1

1 Answer 1

1

You can – sometimes. The default filter contains a question_id field, and according to the examples for the inbox_item type (you have to scroll down a bit) it is filled in some situations. I just tested it and the notification for this comment looks like this:

enter image description here

It should be populated for the new_answer type as well, but I couldn't test this quickly. It is not populated for notifications about comments to your answers; then, only the answer_id field is filed.

You must log in to answer this question.

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