Forum Discussion

synthesis's avatar
12 years ago

How do you derive a post URL from the information contained in a API call?

I have a API call:

 

http://h30434.www3.hp.com/restapi/vc/categories/id/InkJet/posts/recent?page_size=1&restapi.response_format=json&restapi.format_detail=full_list_element

 

That returns this JSON:

 

{"response":{"status":"success","messages":{"message":[{"type":"message","href":"\/messages\/id\/2928261","id":{"type":"int","$":2928261},"read_only":{"type":"boolean","$":false},"root":{"type":"message","href":"\/messages\/id\/2928043"},"parent":{"type":"message","href":"\/messages\/id\/2928043"},"teaser":{"type":"string","$":""},"views":{"count":{"type":"int","$":0}},"board_id":{"type":"int","$":48746},"author":{"type":"user","href":"\/users\/id\/18563","login":{"type":"string","$":"banhien"}},"deleted":{"type":"boolean","$":false},"subject":{"type":"string","$":"Re: Deskjet 3050"},"board":{"type":"board","href":"\/boards\/id\/Software"},"body":{"type":"string","$":"<P>Hi,<\/P><P>&nbsp;<\/P><P>Please download the following Software and Drivers then install to your Windows 7 computer:<\/P><P>&nbsp;<\/P><P>&nbsp;&nbsp; <A target=\"_blank\" href=\"http:\/\/ftp.hp.com\/pub\/softlib\/software12\/COL34584\/al-109394-2\/DJ3050_J610_1315.exe\">http:\/\/ftp.hp.com\/pub\/softlib\/software12\/COL34584\/al-109394-2\/DJ3050_J610_1315.exe<\/A><\/P><P>&nbsp;<\/P><P>Regards.<\/P>"},"thread":{"type":"thread","href":"\/threads\/id\/2928043"},"message_rating":{"type":"float","$":0.0},"last_edit_author":{"type":"user","href":"\/users\/id\/18563","login":{"type":"string","$":"banhien"}},"kudos":{"count":{"type":"int","$":0}},"last_edit_time":{"type":"date_time","$":"2013-09-11T20:59:58+00:00"},"post_time":{"type":"date_time","$":"2013-09-11T20:59:58+00:00"}}]}}}
 
How do I construct a valid URL from this data that a user could click on and it would take them to the forum post? I see that I have the "Message" and "Thread" IDs, but I can't figure out how to turn them into a "http:\\" address.
 
Can anyone help?
 
Thank you!