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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to