synpse-hq / synpse

Synpse is an all-in-one solution to manage your servers and IoT devices providing declarative app deployment, SSH access and TCP tunnels
https://synpse.com
Apache License 2.0
20 stars 3 forks source link

API documentation #29

Open hrfuller opened 1 year ago

hrfuller commented 1 year ago

There are allusions to a REST API that can be used, e.g sample GET commands with curl when generating a service account. However I can't find any description of available api endpoints and the methods they support.

mjudeikis commented 1 year ago

Thanks for the issue. We will try to document this in the following week. Is there anything in particular you are looking for now?

hrfuller commented 1 year ago

Im trying to update an application without installing the CLI, I think I've figured out how to do it by guessing the relationships. Looks like curl -XPATCH --data $app_spec https://cloud.synpse.net/api/projects/$project/namespaces/$namespace/applications/$app works.

Can you use yaml as well as json at these endpoints?

mjudeikis commented 1 year ago

Currently, only JSON is supported. It should not be hard to add support for yaml payload, but it was not on our radar.

Until we document this, a good source for this could be our go client repository: https://github.com/synpse-hq/synpse-go/blob/main/application.go#L77 and application struct itself https://github.com/synpse-hq/synpse-go/blob/main/application.go#L152

Most of the operations can be done using simple crud on the pattern you already found getURL(api.BaseURL, projectsURL, api.ProjectID, namespacesURL, namespace, applicationsURL, p.Name)

I will dedicate some time this weekend to document the most common APIs for this, but until this let me know if any other API you need.

mjudeikis commented 1 year ago

Let us know if this works for you: https://docs.synpse.net/resources/api-documentation https://cloud.synpse.net/swagger.html

It still needs to be populated with few other API's metadata like Jobs, actions, log streaming. But this should be good start.

hrfuller commented 1 year ago

This is an awesome start. I also don't see the projects/*/devices/* endpoints in there yet, but I'm sure you'll add those.

One piece of feedback: the "update" routes shows a POST, but I believe you have to use the PATCH method to update an existing model. At least in my testing that has been true.

mjudeikis commented 1 year ago

Ah, you right. Will adjust. This is based on annotations so I think I added it wrong on the api layer.