Hi Offray,

> On 7 Jun 2017, at 17:21, Offray Vladimir Luna Cárdenas 
> <offray.l...@mutabit.com> wrote:
> 
> Hi,
> 
> I'm prototyping some integration between Fossil and Pharo for the
> creation of dynamic distributed web sites [1]. Now I would like to send
> some messages to store serialized STON domain objects as Fossil wiki
> pages. The command that makes this, using curl, is:
> 
> curl -H "Content-Type: application/json" -d '{"authToken": "mytoken",
> "payload": {"name": "foo", "content": "bar"}}'
> http://localhost:8081/json/wiki/create
> 
> and I thought that a similar command would be the one at [2], but there
> is something about ZnEntity that I'm not understanding.
> 
> How can I replicate the curl command using ZnClient?
> 
> [1] http://smalltalkhub.com/#!/~Offray/Brea
> [2] http://ws.stfx.eu/D61ZOA1LEQNG
> 
> Thanks,
> 
> Offray

That [2] looks about right to me. Though the URL is strange (the json part). 
What do you get as response ? Maybe the authentication just fails. Or you made 
some other mistake ?

I would personally never write JSON manually, but like this:

STONJSON toString: { #authToken->'foo'. #payLoad->({ #name->'test'. 
#content->'something' } asDictionary) } asDictionary.

Or this:

(NeoJSONObject new authToken: 'foo'; payLoad: (NeoJSONObject new name: 'test'; 
content: 'something')) asString.

Different styles/frameworks, same result.

Sven


Reply via email to