3

A while ago I made a little "Recently answered on Stack Overflow" sidebar widget for my homepage. Currently this works by filtering answers out of the user feed however I thought I'd update it to make use of the API instead.

I can successfully retrieve /users/{id}/answers however there doesn't seem to be a field for an answer's URL so is the way to do this just to concatenate

"http://www.stackoverflow.com/questions/" + question_id + "/" + 
  answer_id + "#" + answer_id

This is fine but it doesn't include the URL-friendly version of the question title so if I wanted that in the URL would I have to generate it myself?

2 Answers 2

3

You have to generate any links back to "proper" SO yourself. The most any of the API methods will give you is (relative) links to other API methods.

1
  • 1
    Out of curiosity, why isn't this included as part of the api? It seems like a common enough use case (for example, I need to get the url of an answer object that I just got from the api).
    – Edan Maor
    Commented Jun 13, 2010 at 20:58
3

As of version 2.0 of the API, answers can return a link field in the response, which can be returned in the response by creating a filter that includes it:

enter image description here

You must log in to answer this question.

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