hedgedoc / cli

A tiny CLI for HedgeDoc
GNU Affero General Public License v3.0
153 stars 37 forks source link

Where is the API documentation for CodiMD? #7

Closed jakubgs closed 5 years ago

jakubgs commented 6 years ago

I'd love to add some more options to this tool but I can't seem to find any docs on the API.

Could you maybe add that info in the README.md? So it's easier for a potential contributor to see what's doable.

ccoenen commented 6 years ago

Hi @jakubgs! There's not really much documentation, mostly because we don't really have a defined API in that sense(, yet!). If you wish, we could discuss things over in our matrix channel. Or you could describe what you'd like to achieve in a ticket here or in CodiMD itself and we could give you pointers on where to look.

pirate commented 6 years ago

Here are some of the undocumented endpoints that may interest you @jakubgs:

I've added them to the README here: https://github.com/hackmdio/codimd-cli/blob/master/README.md#api-endpoints

jakubgs commented 6 years ago

Hey, I'm getting on a flight so I won't be responding for a while but what I wanted are two things:

I'll look at the code later, maybe during the weekend.

pirate commented 6 years ago

@ccoenen if you know of an endpoint like https://<codimd_server>/<note_id>/edit that lets us push raw markdown that would probably do the trick, although it will likely require auth unless the permissions are set to Freely.

ccoenen commented 6 years ago

Right now, there is no /edit endpoint. Editing is a little tricky, because you'd also need to inform possibly connected users at the same time. And push them a diff of the document (or at least have them reload the document).

@jakubgs what you might be able to do, if your instance is configured for it, is POST a document to an alias url. So if /list-of-star-wars-collectibles does not yet exist, a new note might be created, and its alias could be list-of-star-wars-collectibles with the content in your POST body. More info can be found here: https://github.com/hackmdio/codimd/pull/673 there it is deschribed for the /new endpoint, but it might be working for any url. If it is not working for any URL, yet, it might be very simple to enable that.

andristeiner commented 6 years ago

To migrate over content of a fairly big Etherpad Lite installation, im interested in adding documents to a given note_id as well. Unfortunately, it does not work by just POST'ing to /desired-name as proposed @ccoenen

pirate commented 5 years ago

Closing this as the API documentation discussion should happen over in the main repo. I've also added a list of the endpoints used by the CLI to the readme. Once an /edit endpoint is added to codimd-server we can open an issue back here to add support for it in the CLI.