Skip to content

Commit

Permalink
Merge pull request #125 from metafacture/123-documentAPI
Browse files Browse the repository at this point in the history
Add a section in README to document the HTTP API.
  • Loading branch information
katauber authored Sep 6, 2023
2 parents 92ef97b + f0c2fc1 commit fc72b12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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,
author)\n"}'
```

0 comments on commit fc72b12

Please sign in to comment.