PortalJS Cloud Portal-Specific API endpoints
As a portal administrator, I'd like to have portal-aware API endpoints, e.g, api.cloud.portaljs.com/my-portal/api/3/action/package_search, so that I can more easily interact programatically with my portal.
This improvement also helps with:
- Simplifying the PortalJS Frontend Starter Template codebase by removing the need for a custom PortalJS Cloud connector (it will be possible to use just a plain CKAN connector)
- Simplifying the code for custom data pipelines (e.g., with the PortalJS Harvesters Framework)
Acceptance Criteria
- [x] The API endpoints that are relevant to the PortalJS Frontend Starter Template have been identified (e.g,
package_search,group_list, etc.)- [x] ... and support portal-awareness
- [x] (Bonus) The API endpoints that are relevant to data pipelines have been identified (e.g.,
organization_create,package_create, etc.)- [x] ... and support portal-awareness
Tasks
- [x] Investigate the most relevant API endpoints
- [x] Decide on an approach for making these endpoints portal-aware
- Ideally,
/my-portal/api/3/action/...for full compatibility with the CKAN core API - Redundancy is also good, e.g, also make the core endpoints portal-aware via headers
- NOTE: core endpoints must still behave as they behave currently for retrocompatibility and smooth migration
- Ideally,
- [x] Implement
Read-only portal-scoped API endpoints have been deployed to prod, without affecting the old portals (NOTE: search facet values haven't been fixed, I have to think of a new strategy to accomplish this)
PRs:
- ckanext-cloud (https://github.com/datopian/ckanext-cloud/pull/12) - Helpers for portal-scoped API endpoints + Portal-scoped
*_list,*_showand*_activity_list - portaljs-frontend-starter (https://github.com/datopian/portaljs-frontend-starter/pull/22/) - Removed multitenancy business logic
- cloud.portaljs.com (https://github.com/datopian/cloud.portaljs.com/pull/111) -
NEXT_PUBLIC_ORGis no longer set on portal deployments
✔️ Old portals still working as before, no breaking changes
✔️ Newly created portal working with the new endpoints:
- Test portal: https://portal-scoped-api.portaljs.com/
- Test portal API docs: https://api.cloud.portaljs.com/@portal-scoped-api/api/3/docs
- Test portal
package_search: https://api.cloud.portaljs.com/@portal-scoped-api/api/3/action/package_search
Pending
*_create, *_update, *_patch endpoints
CC: @willy1989cv @steveoni @anuveyatsu
The following portal-scoped API endpoints have been implemented and deployed to prod:
package_createpackage_updatepackage_patchorganization_createorganization_updateorganization_patchgroup_creategroup_updategroup_patch
See example docs at https://api.cloud.portaljs.com/@portal-scoped-api/api/3/docs
CC: @anuveyatsu @willy1989cv @Abeelha
@demenech feel free to close this issue 👍🏼
FIXED. Portal-scoped API endpoints have been implemented for *_create, *_update and *_patch actions.