Close mysqli connections in api scripts.
Add a conversation API endpoint.
Lookup the initial id, and replies to it.
Avoid duplicate queries, lookup all in_reply_to.
Minor cleanup, add missing backticks in SQL.