Skip to content

Editing a page and its side panel

Théandre Bourry edited this page Jun 22, 2023 · 1 revision

To edit a page, whether that is from the editor or an outside source, you should make a call to the route

POST - api/edit/{pageName}

Of course, if you want to edit an already existing page, unless you want to start from scratch, you should use those two routes

to retreive the content to edit, as this route will very simply erase any file at the name {pageName}.md on the server, to replace its content with whatever is sent in the request.

Route infos

Authorizations

This route requires the user to send a key to the API. This key is 256 characters long and generated completely randomly. It is changed every six months to ensure it isn't cracked.

Parameters

Mandatory

Parameter Data type Description Example
{pageName} string The name of the page to edit. If it contains spaces, they should be replaced by underscores File_Name1

Optional

There are no optional paramters to give for this route.

Request body

This is what the request body will look like:

{
    "fileName": "File_Name1",
    "mainPage": "<main page content>",
    "sidePanel": "<side panel content>",
    "validationString": "<authentication key>"
}
  • fileName: This will override the name given in the route, and will be used as the file name on the server.
  • mainPage: This will contain the raw markdown text to store as the main page content.
  • sidePanel: This will contain the raw markdown text to store as the side panel content.
  • validationString: This will be compared with the key stored locally on the server (after encryption) to see if the user is allowed to send modifications.

Response

When successful, this route returns a 204 HTTP code. If the authentication fails, it will return a 401 (Unauthorized) code. In any case, it won't return any body.