Skip to content

Getting the content of a page

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

To get the main content of any page, you should make a call to the route

GET api/page/{pageName}

This will try to read a file named {pageName}.md in the server's folder containing the main pages. If the file is found, then its content will be returned in a json object.

Route infos

Authorizations

This route is accessible with no authrization at all.

Parameters

Mandatory

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

Optional

There are no optional parameters to give for this route.

Request body

As a GET request, the body should remain empty.

Response

When "successful", this route returns a 200 or a 204 HTTP code. The 204 code means that the page wasn't found, however this is not an error, as in the design of the app, this might occur quite frequently. (Actually, in the first iteration of the NcuWiki front, when this code was encountered, the home page was displayed instead.)
When it is a 200 code, the response body will look something like:

{
    "markdown": "[link]: ?Page\nMarkdown content ....."
}