Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is the API documentation for CodiMD? #7

Closed
jakubgs opened this issue Oct 17, 2018 · 7 comments
Closed

Where is the API documentation for CodiMD? #7

jakubgs opened this issue Oct 17, 2018 · 7 comments

Comments

@jakubgs
Copy link

jakubgs commented Oct 17, 2018

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
Copy link
Collaborator

ccoenen commented Oct 17, 2018

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
Copy link
Member

pirate commented Oct 18, 2018

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

  • https://<codimd_server>/history (requires auth)
  • https://<codimd_server>/new
  • https://<codimd_server>/<note_id>/publish
  • https://<codimd_server>/<note_id>/download
  • https://<codimd_server>/<note_id>/pdf
  • https://<codimd_server>/<note_id>/slide

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

@jakubgs
Copy link
Author

jakubgs commented Oct 18, 2018

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

  • Able to specify the URL under which I want to import the document
  • Able to import a Mardown file multiple times to the same URL

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

@pirate
Copy link
Member

pirate commented Oct 18, 2018

@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
Copy link
Collaborator

ccoenen commented Oct 18, 2018

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: hackmdio/codimd#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
Copy link

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
Copy link
Member

pirate commented Nov 23, 2018

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.

@pirate pirate closed this as completed Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants