Hi all, It seems that POSTing /processes with JSON data is not fully implemented: [lib/rep/launchitem.rb:40 # TODO : parse_launchitem_json (json)]
Following the code that deals with XML, I've added a bit of code in
order to enable support for JSON. Here it is:
file 'lib/rep/launchitem.rb':
40 # TODO : parse_launchitem_json (json)
41 def parse_launchitem_json (json)
42
43 OpenWFE::Json.launchitem_from_json json
44 end
file 'vendor/ruote/lib/openwfe/representations.rb'
366 def Json.launchitem_from_json (json)
367
368 li = LaunchItem.new
369 h = Json.as_h(json)
370
371 li.wfdurl =
372 h['workflow_definition_url'] ||
373 h['definition_url']
374
375 li.attributes =
376 h['attributes'] ||
377 h['fields'] ||
378 {}
379
380 li.attributes['__definition'] = h['definition'] if h['definition']
381
382 li
383 end
I've attached these two files already modified.
Now, it would be possible to do this:
1. create a process specifying its attributes and definition:
curl -i -H "Accept: application/json" -H "Content-Type:
application/json" -X POST http://localhost:4567/processes
--data-binary '{"attributes":{"field1":"value1"}, "definition":"class
Test0 < OpenWFE::ProcessDefinition; sequence do; foxtrot; alpha; end;
end;"}'
2. create a process specifying its url definition and attributes:
curl -i -H "Accept: application/json" -H "Content-Type:
application/json" -X POST http://localhost:4567/processes
--data-binary
"{"workflow_definition_url":"public/process_definitions/sequence0.rb","attributes":{"field1":"value1"}}"
As with XML, "workflow_definition_url" and "definition_url" are
interchangeable. So are "attributes" and "fields". The following
command is equivalent to the above one:
curl -i -H "Accept: application/json" -H "Content-Type:
application/json" -X POST http://localhost:4567/processes
--data-binary
"{"definition_url":"public/process_definitions/sequence0.rb","fields":{"field1":"value1"}}"
Best regards.
Have a nice day and weekend.
Gonzalo.
--~--~---------~--~----~------------~-------~--~----~
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---
launchitems.rb
Description: Binary data
representations.rb
Description: Binary data
