portaljs icon indicating copy to clipboard operation
portaljs copied to clipboard

PortalJS Cloud Portal-Specific API endpoints

Open demenech opened this issue 2 months ago • 2 comments

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
  • [x] Implement

demenech avatar Oct 10 '25 00:10 demenech

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, *_show and *_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_ORG is 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

demenech avatar Oct 29 '25 18:10 demenech

The following portal-scoped API endpoints have been implemented and deployed to prod:

  • package_create
  • package_update
  • package_patch
  • organization_create
  • organization_update
  • organization_patch
  • group_create
  • group_update
  • group_patch

See example docs at https://api.cloud.portaljs.com/@portal-scoped-api/api/3/docs

CC: @anuveyatsu @willy1989cv @Abeelha

demenech avatar Nov 24 '25 21:11 demenech

@demenech feel free to close this issue 👍🏼

anuveyatsu avatar Dec 15 '25 07:12 anuveyatsu

FIXED. Portal-scoped API endpoints have been implemented for *_create, *_update and *_patch actions.

demenech avatar Dec 15 '25 13:12 demenech