How to get destination address and amount from result of getrawtransaction and how to distinguish it from "change" address using rpc api.
getrawtransaction RPC will provide you with details about a particular transaction. However, answering your question further is complicated by several issues:
Transactions are not required to have change addresses. Good wallets will attempt to avoid using change addresses when change isn't necessary.
Transactions may have more than two outputs, so there's not necessarily a single payment address.
Transactions may pay a bare (non-P2SH) multisig output which comprises several public keys. GetRawTransaction will display these as multiple addresses.
In a well-implemented wallet, change should be indistinguishable from a payment within a single transaction. You would need to analyze multiple transactions or have information from the party that received payment in order to be able to determine which output is a change address.
In short, I don't think GetRawTransaction or any other RPC will provide you with the information you want for arbitrary block chain transactions. However, if you're only interested in information about transactions in the local wallet, the
gettransaction RPC is what you're looking for.