Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network API loccontrol should also handle a JSON body request #34

Open
jsccast opened this issue Oct 31, 2016 · 0 comments
Open

Network API loccontrol should also handle a JSON body request #34

jsccast opened this issue Oct 31, 2016 · 0 comments

Comments

@jsccast
Copy link
Member

jsccast commented Oct 31, 2016

As rules/add does. In other words, the following should work:

cat <<EOF | curl -s -d "@-" "$ENDPOINT/api/sys/loccontrol"
{"Libraries":{"jokes":"function funny() { return 42; }"}}
EOF

cat <<EOF | curl -s -d "@-" "$ENDPOINT/api/loc/rules/add?location=$LOCATION"
{"rule": {"when":{"pattern":{"wants":"?x"}},
          "action":{"opts": {"libraries":["jokes"]},
                    "code": "funny()+1"}}}
EOF

curl -s -d 'event={"wants":"tacos"}' "$ENDPOINT/api/loc/events/ingest?location=$LOCATION" | \
   jq '.result.values[0]'

Currently does not. If you do

curl -s --data-urlencode 'control={"Libraries":{"jokes":"function funny() { return 42; }"}}' "$ENDPOINT/api/sys/loccontrol"

instead of the first curl above, things do work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant