ehazlett / stellar

Simplified Container System
MIT License
1.14k stars 35 forks source link

How do I use the gRPC Gateway API? #33

Open unixfox opened 5 years ago

unixfox commented 5 years ago

I found here https://github.com/ehazlett/stellar/pull/8 that it's possible to interact with the API using HTTP but I don't really know the endpoints of that API, is it possible to help me how to find them or maybe add swagger for an easy use of the API?

ehazlett commented 5 years ago

It was started as an experimental feature (https://github.com/ehazlett/stellar/blob/master/api/services/cluster/v1/cluster.proto#L17). I think we should add some more routes and investigate to see if this is the way we want to go or possibly pull the HTTP gateway out into a separate project and keep the core clean.

unixfox commented 5 years ago

Thank you for your reply. I don't mind using the actual gRPC API instead of the gateway one do you have any tips for me to know the endpoints? I tried to use grpccurl but it requires building a protoset and it's quite complicated for me due to the fact that I don't really know golang.

ehazlett commented 5 years ago

If you are using Go you can just use the Stellar Client (https://github.com/ehazlett/stellar/blob/master/client/client.go#L47). That's what Stellar uses internally for all API operations.

unixfox commented 5 years ago

I'm not familiar with Golang what if I want to interact with the gRPC API using NodeJS for example?

ehazlett commented 5 years ago

Typically you would generate using the protos for whatever language you want.

ehazlett commented 5 years ago

i.e. https://developers.google.com/protocol-buffers/docs/reference/javascript-generated