synpse icon indicating copy to clipboard operation
synpse copied to clipboard

API documentation

Open hrfuller opened this issue 2 years ago • 4 comments

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.

hrfuller avatar Apr 18 '23 02:04 hrfuller

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

mjudeikis avatar Apr 18 '23 05:04 mjudeikis

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?

hrfuller avatar Apr 18 '23 15:04 hrfuller

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 avatar Apr 18 '23 15:04 mjudeikis

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.

mjudeikis avatar Apr 23 '23 14:04 mjudeikis

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.

hrfuller avatar Apr 26 '23 23:04 hrfuller

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

mjudeikis avatar May 02 '23 09:05 mjudeikis