https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22994

--- Comment #3 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 196022
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196022&action=edit
Bug 22994: Add PUT /config/search_mappings endpoint

This patch adds a PUT endpoint to import/replace search field mappings.
It accepts both JSON and YAML request bodies, matching the export
format from GET /config/search_mappings.

The existing reset_elasticsearch_mappings method is extended to accept
an optional mappings hashref, allowing reuse for both reset-to-defaults
and import-from-user-data flows.

To test:
1. Apply this patch (and the previous API endpoint patches)
2. Rebuild the API bundle:
   $ yarn api:bundle
3. Restart Plack
4. Export current mappings:
   $ curl -u user:pass -H 'Accept: application/yaml' \
     /api/v1/config/search_mappings > mappings.yaml
5. Edit mappings.yaml (e.g. change a label)
6. Import the modified mappings:
   $ curl -u user:pass -X PUT \
     -H 'Content-Type: application/yaml' \
     --data-binary @mappings.yaml \
     /api/v1/config/search_mappings
=> SUCCESS: Returns 200 with the imported mappings
7. Verify the changes:
   $ curl -u user:pass /api/v1/config/search_mappings
=> SUCCESS: Modified label is reflected
8. Run:
   $ prove t/db_dependent/api/v1/config_search_mappings.t
=> SUCCESS: Tests pass
9. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to