-
-
Notifications
You must be signed in to change notification settings - Fork 81
AJAX Endpoint
The Ajax-Endpoint is the endpoint that the Editor uses to load and save data from the server. Instead of providing different endpoints the H5P-Team used one endpoint which can be configured via the ajaxPath
-field in the Editor-Integration-Object
As far as my research goes, it works like this:
GET or POST /ajaxPath?action=
Method:
GET /ajaxPath?action=content-type-cache
Response:
{
"outdated": boolean,
"libraries": Array<Library>
}
See Communication with the H5P Hub for details on how to construct the content type cache (which confusingly is actually a "view" of the user on the usable libraries).
Method:
GET /ajaxPath?action=libraries?machineName=<machine_name>&majorVersion=<major_version>&minorVersion=<minor_version>
Response:
{
"semantics": LibrarySemantics,
"language": LibraryLanguage,
"javascript": Array<JSDependency>,
"css": Array<CSSDependency>,
"translation": LibraryTranslation
}
Method:
POST /ajaxPath?action=libraries
Body:
Array<LibraryName>
Example:
["H5P.AdvancedText 1.1", "H5P.AppearIn 1.0"]
Response:
Array<Library>
Method:
POST /ajaxPath?action=files
Body: file
Response:
{
mime: MimeType,
path: Path
}
I hope this makes it a little bit clearer and helps you understand how the H5P-Editor works. There might be other mechanisms that I am not aware of, so please feel free to contribute and share your knowledge about the H5P-Structure.