From f6ce002af2b20c1fbad9903ea5b17dd6cd2c9f27 Mon Sep 17 00:00:00 2001 From: katauber Date: Fri, 1 Sep 2023 14:52:27 +0200 Subject: [PATCH 1/3] Add a section in README to document the HTTP API. See #122 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 349ee8e..89e620d 100644 --- a/README.md +++ b/README.md @@ -168,3 +168,12 @@ retain(id, title, author) The parameter values must be URL-encoded so the URL looks like this: http://localhost:3000/process?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cdecode-formeta%0A%7Cfix%28transformationFile%29%0A%7Cencode-xml%28rootTag%3D%22collection%22%29%0A%7Cprint%0A%3B&transformation=move_field%28_id%2C+id%29%0Amove_field%28a%2C+title%29%0Apaste%28author%2C+b.v%2C+b.n%2C+%27~aus%27%2C+c%29%0Aretain%28id%2C+title%2C+author%29&data=1%7Ba%3A+Faust%2C+b+%7Bn%3A+Goethe%2C+v%3A+JW%7D%2C+c%3A+Weimar%7D%0A2%7Ba%3A+R%C3%A4uber%2C+b+%7Bn%3A+Schiller%2C+v%3A+F%7D%2C+c%3A+Weimar%7D + +## Use Metafacture Playground API + +Beside using the Metafacture Playground webapplication it's possible to access workflow results via API. + +``` +curl -X POST https://test.metafacture.org/playground/process -H 'Content-Type: application/json' -d '{"data":"1{a: Faust, b {n: Goethe, v: JW}, c: Weimar}\n2{a: Räuber, b {n: Schiller, v: F}, c: Weimar}","flux":"inputFile\n|open-file\n|as-lines\n|decode-formeta\n|fix(transformationFile)\n|encode-xml(rootTag=\"collection\")\n|print\n;","transformation":"move_field(_id, id)\nmove_field(a, title)\npaste(author, b.v, b.n, \"~aus\", c)\nretain(id, title, + author)\n"}' +``` \ No newline at end of file From 7faaca95d1c3e279813e215a38bbdc19bf7bd054 Mon Sep 17 00:00:00 2001 From: Katinka Tauber Date: Mon, 4 Sep 2023 10:13:10 +0200 Subject: [PATCH 2/3] Remove duplication after review. See #123 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89e620d..e299276 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ http://localhost:3000/process?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cd ## Use Metafacture Playground API -Beside using the Metafacture Playground webapplication it's possible to access workflow results via API. +Beside the web application the Metafacture Playground provides a HTTP REST API to process workflows.To process a workflow you need to provide the workflow information as JSON parameters in your POST request. ``` curl -X POST https://test.metafacture.org/playground/process -H 'Content-Type: application/json' -d '{"data":"1{a: Faust, b {n: Goethe, v: JW}, c: Weimar}\n2{a: Räuber, b {n: Schiller, v: F}, c: Weimar}","flux":"inputFile\n|open-file\n|as-lines\n|decode-formeta\n|fix(transformationFile)\n|encode-xml(rootTag=\"collection\")\n|print\n;","transformation":"move_field(_id, id)\nmove_field(a, title)\npaste(author, b.v, b.n, \"~aus\", c)\nretain(id, title, From f0c2fc18e23efb75c9d46ca4e9df162dad4ff403 Mon Sep 17 00:00:00 2001 From: Katinka Tauber <72247962+katauber@users.noreply.github.com> Date: Mon, 4 Sep 2023 10:13:40 +0200 Subject: [PATCH 3/3] Update README.md after review Co-authored-by: Pascal Christoph --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e299276..82966a6 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ http://localhost:3000/process?flux=inputFile%0A%7Copen-file%0A%7Cas-lines%0A%7Cd ## Use Metafacture Playground API -Beside the web application the Metafacture Playground provides a HTTP REST API to process workflows.To process a workflow you need to provide the workflow information as JSON parameters in your POST request. +Beside the web application the Metafacture Playground provides a HTTP API to process workflows. All you need is to provide the workflow information as JSON parameters in your POST request. ``` curl -X POST https://test.metafacture.org/playground/process -H 'Content-Type: application/json' -d '{"data":"1{a: Faust, b {n: Goethe, v: JW}, c: Weimar}\n2{a: Räuber, b {n: Schiller, v: F}, c: Weimar}","flux":"inputFile\n|open-file\n|as-lines\n|decode-formeta\n|fix(transformationFile)\n|encode-xml(rootTag=\"collection\")\n|print\n;","transformation":"move_field(_id, id)\nmove_field(a, title)\npaste(author, b.v, b.n, \"~aus\", c)\nretain(id, title,