Expose a REST end-point through standard routing
Overview
Provide a binding for CRM_Utils_REST in the conventional routing system.
Example use-case
- Create a D8 site
- Create user/contact and set their API key
- Access the
rest
end-point with their API key
Current behavior
- There is a binding through the
extern/rest.php
. - There are tests for the REST contract in
E2E_Extern_RestTest
- The end-point is difficult to use/deploy in environments like D8.
Proposed behavior
- There is another binding
civicrm/api/rest
which speaks the same protocol. - The RestTest hits both end-points (depending on what's valid/available for the given build).
- References to the REST endpoint (eg RestTest and API Explorer) are constructed via
CRM_Utils_System::externUrl('extern/rest')
Comments
- This is an offshoot of drupal#7 (closed) and cloud-native#16 (moved)
- This sounds easier than it is.
- There's a draft/WIP: https://github.com/civicrm/civicrm-core/pull/17952
- The protocol's authentication-handler is tied into
CRM_Utils_System::loadBootstrap()
. This needs refactoring/reworking to apply to be valid in a standard route.
Edited by totten