Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

There is no link field on notification. Is this by design or a bug? If it's by design can it be changes so it's included, I can't see how to build the URL with only a post id, and not know what type of post it is?

share|improve this question
add comment

2 Answers

Notifications typically contain links within their bodies. They're considerably more free-form than inbox_items, in that they're not typically attached to a post.

Notifications only even have directly attached posts (at time of writing) in the bounty and edit cases.

Note that if there's a post_id present, you can query /posts/{ids} to get a link. Alternatively, you can do as George suggested; those links aren't getting broken anytime soon.

tl;dr - notifications wouldn't typically have links, but we'd have to do a lot of work just in case. The omission of link is by design for v2.1.

share|improve this answer
    
Ah right, I was stripping all the HTML, probably should have checked the raw data more thoroughly before posting. But it seems most (if not all) notifications only have one link in them? Would it be possible to add a link field and have it contain the link that is in the body? –  Jonathan. Jul 21 '12 at 0:14
add comment

This is possible. Just use the format below:

http://some_site.stackexchange.com/q/ {post_id}

This will work regardless of whether the post is a question or answer. If the post is an answer, the site will automatically redirect you to the URL for the answer.

Example for this answer: http://stackapps.com/q/3550

share|improve this answer
    
But why is this inconsistent with many 2.0 items. link was introduced to avoid having to build the URL yourself? –  Jonathan. Jul 20 '12 at 18:02
    
Well, I can't comment on that - I can only tell you how I work around the problem. –  Nathan Osman Jul 20 '12 at 18:17
add comment

You must log in to answer this question.

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