Last active
May 9, 2020 11:42
-
-
Save jmakeig/1913f50def91f4c5f7f1802cee7a6b81 to your computer and use it in GitHub Desktop.
Evaluates JavaScript against MarkLogic from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Pipes stdin as the JavaScript body of a REST Client API eval request | |
# | |
# Usage: | |
# cat mycode.sjs | marklogic-eval.sh | |
# pbpaste | marklogic-eval.sh | |
cat <(echo 'javascript=') <(cat -) | curl http://localhost:8000/v1/eval \ | |
--digest -u admin:admin -X POST \ | |
-H 'Accept: multipart/mixed' \ | |
-H 'Content-Type: application/x-www-form-urlencoded' \ | |
-d @- | |
# TODO: Specify query type as command line option | |
# TODO: Parse query type from file extension | |
# TODO: Parse multipart output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment