From 3c525a06286f5461a36078d763f40f2feb07e6bf Mon Sep 17 00:00:00 2001 From: katauber Date: Fri, 1 Sep 2023 14:52:27 +0200 Subject: [PATCH] Add a section in README to document the HTTP REST API. See #123 --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 743df63..35a3627 100644 --- a/README.md +++ b/README.md @@ -145,3 +145,17 @@ lein test Run workflows on the web server, passing `data`, `flux`, and `fix` as GET-Parameter: [http://localhost:3000/process?data='1'{'a': '5', 'z': 10}&flux=as-lines|decode-formeta|fix|encode-formeta(style="multiline")&fix=map(a,b) map(_else)](http://localhost:3000/process?data=%271%27{%27a%27:%20%275%27,%20%27z%27:%2010}&flux=as-lines|decode-formeta|fix|encode-formeta(style=%22multiline%22)&fix=map(a,c)%20map(_else)) + +## Use Metafacture Playground API + +Beside using the Metafacture Playground webapplication it's possible to access workflow results via API. + +## 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":"infile\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"}' +``` + +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":"infile\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"}' +