REST API
Performing Requests
Administrative REST routes require that you specify certain administration headers.
Each module exposes its administrative routes under /moduleName/
.
Route Documentation
Conduit automatically generates OpenAPI schemas for all of your routes to be used by Swagger.
This means your REST API is fully documented and even available for interaction through Swagger UI.
You may always locate your Swagger UI pages and grab the exported JSON files through the Admin Panel.
Examples
The Database module accepts GET
requests to /database/documents
.
That's how your end-user applications would query for custom (CMS) schema documents.
User authenticated routes additionally require an Authorization header containing a user authentication bearer token.
In fact, for anyone making use of Local Authentication (enabled by default), retrieving that very same user access token is also accomplished through an application request.
curl --location --request POST 'http://localhost:3000/authentication/local' \
--header 'masterkey: M4ST3RK3Y' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "I_h4t3_p4ss_r3qu1r3m3nts"
} '
{
"userId": "6242f1bb10a09901827738fe",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyNDJmMWJiMTBhMDk5MDE4Mjc3MzhmZSIsImlhdCI6MTY0ODU1NDUyNywiZXhwIjoxNzM0OTU0NTI3fQ.Fjqa7ORBBF2giwG7OgiWr2HMgHDL7R6ddFq2E730Djc",
"refreshToken": "BsKhe3ARhL/FfDfK1REphKkkqQaxRCj/LvvRHOg5wCXCBaUSOwafRHyFYIttaORY/NmHS7NAuT6+knBQegVOwQ=="
}