[jboss-user] [jBPM] - Re: Create WID Using Rest API

Tihomir Surdilovic do-not-reply at jboss.com
Fri Mar 16 21:44:41 EDT 2012


Tihomir Surdilovic [https://community.jboss.org/people/tsurdilovic] created the discussion

"Re: Create WID Using Rest API"

To view the discussion, visit: https://community.jboss.org/message/724445#724445

--------------------------------------------------------------
If you want to store files to Guvnor using its rest api here is an example:


                URL createServiceNodeIconURL = new URL(packageAssetsURL);
                HttpURLConnection createServiceNodeIconConnection = (HttpURLConnection) createServiceNodeIconURL
                        .openConnection();
                applyAuth(profile, createServiceNodeIconConnection);
                createServiceNodeIconConnection.setRequestMethod("POST");
                createServiceNodeIconConnection.setRequestProperty("Content-Type",
                        "application/octet-stream");
                createServiceNodeIconConnection.setRequestProperty("Accept",
                        "application/atom+xml");
                createServiceNodeIconConnection.setRequestProperty("Slug", "defaultservicenodeicon.png");
                createServiceNodeIconConnection.setDoOutput(true);
                createServiceNodeIconConnection.getOutputStream().write(getBytesFromFile(new File(default_servicenodeicon)));
                createServiceNodeIconConnection.connect();
                System.out.println("created service node icon: " + createServiceNodeIconConnection.getResponseCode());


Where packageAssetsURL if you are working in a package named "somePackage" could be localhost:8080/drools-guvnor/rest/packages/somePackage/assets. To store files you have to use the "Slug" header to tell Guvnor what the name of your asset it. Note that you should check if this asset exists first and delete it before storing a new one. 

Hope this helps.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/724445#724445]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120316/14efd533/attachment-0001.html 


More information about the jboss-user mailing list