Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

"" + 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?

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
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 Jun 13 '10 at 20:58

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

share|improve this answer

You must log in to answer this question.

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