That was one iteration I missed. It worked. Thanks.
The extra backslash was my edit error in the email. Striping out internal
function names.
"\{couch_httpd_external, handle_external_req, <<'my_function'>>\}"
"\"{couch_httpd_external, handle_external_req, <<'my_function'>>\}\""
"{couch_httpd_external, handle_external_req, \<\<'my_function'\>\>}"
"\{couch_httpd_external, handle_external_req, <<\"my_function\">>\}"
'"couch_httpd_external, handle_external_req, %3C%3C%22my_function%22%3E%3E"'
Just to name a few.
________________________________
From: muji <[email protected]>
To: [email protected]; Scott Weber <[email protected]>
Sent: Friday, January 31, 2014 1:09 PM
Subject: Re: API to Update httpd_db_handlers in Config
I think the additional backslash before the > is causing the problem, try:
"{couch_httpd_external, handle_external_req, <<\"my_function\">>}"
This works for me:
echo '"{couch_httpd_external, handle_external_req, <<\"my_function\">>}"' |
jsonlint
Whilst:
echo '"{couch_httpd_external, handle_external_req, <<\"my_function\"\>>}"'
| jsonlint
Fails.
On 1 February 2014 02:30, Scott Weber <[email protected]> wrote:
> How does one perform am API based update to the "httpd_db_handlers"
> section of the config.
>
>
> Given something like this:
>
>
> [httpd_db_handlers]
> _my_function = {couch_httpd_external, handle_external_req,
> <<"my_function">>}
>
> I try to update it with:
>
> couchSend( "PUT /_config/httpd_db_handlers/_my_function",
>
> "{couch_httpd_external, handle_external_req, <<\"my_functioni\"\>>}"
> );
>
> If failing with a "invalid JSON"... Which I can see that it is.
> It logs "lexical error: invalid char in json text.\n"}}, But doesn't
> tell me which character it doesn't like.
>
>
> However, I was able to update something else like this:
>
> couchSend( "PUT /_config/log/include_sasl",
>
> "\"false\"" );
>
> And it works fine.
>
> Without wasting a bunch of bandwidth telling ALL the different ways I have
> tried to escape the quotes, added extra quotes, encoded angle brackets,
> braces, tried using text/plain, text/html, etc... (or tell my boss how much
> it cost him while I am trying all different these ways, and doing web
> searches) I figure I'll just give up and ask. :-)
>
>
> How does one encode the following string for an API based config update?
>
> {couch_httpd_external, handle_external_req, <<"my_function">>}
>
> Thanks.
> -Scott
>
--
mischa (aka muji).