paritytech / polkassembly

Polkassembly now has a new home:
https://github.com/Premiurly/polkassembly
Apache License 2.0
29 stars 37 forks source link

App endpoint #1106

Open chevdor opened 3 years ago

chevdor commented 3 years ago

Background

Polkassembly is one of the places of choice to share network relevant discussions and open discussions such as results of running srtool (https://gitlab.com/chevdor/srtool).

As part of a series of improvements for srtool, I would love to simplify the publishing of the results and such an endpoint would be an elegant solution.

Proposal

This proposal consists in a new openly available ingestion endpoint, allowing devs and apps to post to polkassembly directly using its API.

In particular, this could help aggregate data in a single place and prevent the flourishing of unlinked single posts.

Details

I would like to open the discussion here to see how feasable it would be to add such an endpoint.

method: POST payload:

{
   app: string,
   keys: Record<string, string>,
   data: any
}

Here would be a sample payload:

{
   app: "srtool",
   keys: { commit: "999999999" },
   data: { proposalHash: "0x12345" }
}

Benefit

Instead of having users (and apps) posting in new random discussions, this endpoint would allow creating one single discussion for a given set of keys (as defined in the payload). It would allow collecting the data from the payload in a single place while allow people to discuss in this single thread.

data could but does not have to be interpreted and could be simply added as attachement into a thread.

niklabh commented 3 years ago

What is this API doing. Is it creating a new Post for discussion with keys and data?

chevdor commented 3 years ago

Yes, it API will either create a new post or append to an existing one.

If the set payload.app + payload.keys is not found, it creates a new post. If it is present however, it will add the payload.data to the existing post.