Skip to content

feat: add optional ?server=local/pre_ckan query param to PUT /url/{resource_id}#41

Merged
rbardaji merged 3 commits intomainfrom
feat/put-url-server-queryparam
Mar 2, 2025
Merged

feat: add optional ?server=local/pre_ckan query param to PUT /url/{resource_id}#41
rbardaji merged 3 commits intomainfrom
feat/put-url-server-queryparam

Conversation

@rbardaji
Copy link
Copy Markdown
Collaborator

@rbardaji rbardaji commented Mar 2, 2025

Overview
This pull request adds an optional server query parameter to the
PUT /url/{resource_id} endpoint, allowing users to specify whether they
want to update the resource in the local CKAN instance or in the
pre-CKAN instance. If no server parameter is provided, the endpoint
defaults to 'local' to maintain backward compatibility.

Changes

  1. Introduced a ckan_instance parameter in update_url to avoid
    relying solely on ckan_settings.ckan.
  2. Added ?server=local or ?server=pre_ckan to the PUT /url/{resource_id}
    route.
  3. Returns a 400 error if pre_ckan is disabled (pre_ckan_enabled=False)
    or if the pre_ckan URL is missing a valid scheme ("No scheme supplied").
  4. Preserves existing behavior when the server parameter is not specified,
    defaulting to local CKAN.

Impact

  • Provides explicit control over which CKAN instance to use for URL
    resource updates.
  • Delivers user-friendly error messages if the pre_ckan configuration
    is invalid.
  • No breaking changes for existing clients that do not pass ?server=.

Testing

  • Verified locally that ?server=pre_ckan uses the pre-CKAN instance
    if enabled and properly configured.
  • Confirmed that calls without ?server continue using local CKAN
    without any change in behavior.

@rbardaji rbardaji merged commit a2e51ba into main Mar 2, 2025
@rbardaji rbardaji deleted the feat/put-url-server-queryparam branch March 2, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant