Migrate to new politeia API
lukebp opened this issue · 4 comments
These are the politeiawww enpoints that dcrdata currenlty uses:
- RouteAllVetted
- RouteProposalDetails
- RouteVoteStatus
- RouteAllVoteStatus
These endpoints have been deprecated in the recent politeia release.
Listed below are the routes that should be used instead. dcrdata currently pulls the politeia git repos manually in order to build the vote graphs. This is not required anymore. All data that dcrdata needs should be available through the politeia API.
The release also includes a politeiawww client to make interacting with the API easier. This will replace the dcrdata piclient
package.
politeiawww client
The new API uses generic record routes. A record is application agnostic. It can be a proposal, a cms invoice, a cms DCC, or any other type of record.
Record structure
RouteAllVetted
Replaced by inventory ordered route.
req/reply payloads
client method
RouteProposalDetails
Replaced by record details route.
req/reply payloads
client method
pictl reference cmd
Here's a function that converts a record to a proposal from the legacy www/v1
API. This shows how proposal data is formatted in the generic record structure.
https://github.com/decred/politeia/blob/master/politeiawww/proposals.go#L863
RouteVoteStatus and RouteAllVoteStatus
Replaced by ticket vote summaries route.
req/reply payloads
client method
pictl reference cmd
Cast vote data
The cast vote replies now contain the vote timestamp so that the dcrdata vote graphs can be built using the API data.
req/reply payloads
client method
pictl reference cmd
Feel free to ping me if you have any questions.
Will be working on this 👍
Thanks, @lukebp. I am very please that we don't need to get vote history from either git or a tlog backend directly.
Oh, and a related issue is getting the final snapshot of Pi data from the old API and storing it somewhere pre-parsed. That can probably be separate work though... depends on the changes.