Consider the following function:
f[json_] := URLFetch[
"https://developers.betfair.com/api.betfair.com/exchange/betting/\
json-rpc/v1",
{"StatusCode", "Headers", "Content"},
"Body" -> json,
Method -> "POST",
"Headers" -> {"X-Application" -> DEVKEY,
"X-Authentication" -> TOKEN}]
( TOKEN and DEVKEY have values but are private )
The function is called as follows:
f["[
{\"jsonrpc\": \"2.0\",
\"method\": \"SportsAPING/v1.0/listEventTypes\",
\"params\": {\"filter\":{}}}
]"]
I have a question about creating this json string.
Simplified I would like to be able to create this string from something like
{"jsonrpc" -> "2.0", "method" -> method, "params" -> {"filter" -> "{}"}}
where method contains for example
"SportsAPING/v1.0/listEventTypes\".
such that the URLFetch still works.
Is this possible?
(I tried several ToString's but I don't get it to work except if json contains exactly the value
"[
{\"jsonrpc\": \"2.0\",
\"method\": \"SportsAPING/v1.0/listEventTypes\",
\"params\": {\"filter\":{}}}
]"
including escape characters.
A different URLFetch ( or 11.0 equivalent ) is acceptable.
Export
toJSON
format? If you use an association representation, useRawJSON
or the fast JSON functions from theDeveloper`
context. $\endgroup$"Compact" -> True
, that should do, right? $\endgroup$