cancel
Showing results for 
Search instead for 
Did you mean: 

Set the editor source for a model

gahospin
Champ in-the-making
Champ in-the-making
Hi,

I'm traying to "Set the editor source for a model" like the documentation indicate me on the web. I have to do this:

PUT repository/models/{modelId}/source

and:

Request body: The request should be of type multipart/form-data. There should be a single file-part included with the binary value of the source.

I don't understand how to send the body, what is exactly the body? Can anybody help me pls?

My questions:

Wha should I to send it to the service? how? I am trying from Java. Can you give an example?

Thanks…
1 REPLY 1

gahospin
Champ in-the-making
Champ in-the-making
Thanks guys,

I can resolve it. Here my solution:

ClientRequest add_request = new ClientRequest("http://localhost:9191/activiti-rest/service/repository/models/6852/source");
add_request.header("Authorization", "Basic a2VybWl0Omtlcm1pdA==");
MultipartFormDataOutput upload = new MultipartFormDataOutput();

String p="{\"id\":\"canvas\",\"resourceId\":\"canvas\",\"stencilset\":{\"namespace\":\"http://b3mn.org/stencilset/bpmn2.0#\"}}";
  byte[] b=p.getBytes();
upload.addFormData("file-part ", b, MediaType.MULTIPART_FORM_DATA_TYPE);
 
add_request.body(MediaType.MULTIPART_FORM_DATA_TYPE, upload);
add_request.put();