REST API. Update of User/UserGr. not possible (5.11)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2013 08:21 AM
Introduction
——————-
User Guide (currently 5.12) describes, that POST http method must be used to create an user or an user group. But i found such githubentry:
The user guide (5.9-5.12) lists the creation of user and groups going through the POST http method, however the code is written to use the PUT method.
i look at this classes
UserCreateResource.java
GroupCreateResource.java
Thay have actually "Put" Annotation.
User Guide has such text:
Create group——————-
Creates a new group.
Request: POST /group
{
"id": "admin",
"name": "System administrator",
"type": "security-role"
}
API: identityService.newGroup(); identityService.saveGroup();
Base Part
Currenlty is it not possible, to change, for instance, the user first or surename or name of the user group using REST API.
If i try to deploly the user group with same user group id, the exception will be thrown. The realisation.
if (identityService.createGroupQuery().groupId(groupInfo.getId()).count() == 0) { Group group = identityService.newGroup(groupInfo.getId()); group.setName(groupInfo.getName()); if (groupInfo.getType() != null) { group.setType(groupInfo.getType()); } else { group.setType("assignment"); } identityService.saveGroup(group); } else { throw new ActivitiException("group id must be unique"); } return new StateResponse().setSuccess(true);
IMHO, the exception is fully correctly according the semantic of a class with name, containing "Create" infix.
Are you planning to realize "update" operations for an user /an user group in REST API?
——————-
Conclusion, CRUD operations and REST
After googling, i found different reviews, related to mapping of http methods to CRUD operations using REST.
What understand activiti developers under PUT / POST related to CRUD operations?
P.S The googling results:
1
CRUD HTTP
Create POST
Retrieve GET
Update PUT
Delete DELETE
CRUD HTTP2
Create PUT
Retrieve GET
Update PUT
Delete DELETE
After that discussion, a more realistic mapping would seem to be:
Create = PUT iff you are sending the full content of the specified resource (URL).
Create = POST if you are sending a command to the server to create a subordinate of the specified resource, using some server-side algorithm.
Retrieve = GET.
Update = PUT iff you are updating the full content of the specified resource.
Update = POST if you are requesting the server to update one or more subordinates of the specified resource.
Delete = DELETE.
——————-
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2013 10:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2013 05:48 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2013 03:47 AM
When I try to use put to create a new group I get the message "forbidden".
What do I need to do in order to successfully create a group via REST? Login is working but it only respond with status OK 200 so I'm not sure how to authenticate on each other REST call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2013 01:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2013 06:46 AM

Another thing: I'm testing all rest api calls you currently have and I'm having some doubts whether I'm doing it right or wrong.
For example if I run the following call: http://localhost:8081/activiti-rest/service/users?searchText=kermit
response I get is: {"data":[],"total":0,"start":0,"sort":"lastName","order":"asc","size":0}
With kermit I was able to authenticate the call. It might be I'm doing something wrong with parsing json response, but I can't be sure. Can anyway confirm that this query should return the kermit user data?
Here is the code example of invoking this call:
<java>
public void searchUser(){
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("kermit", "kermit"));
WebResource webResource = client
.resource("http://localhost:8081/activiti-rest/service/users?searchText=kermit");
ClientResponse response;
try {
response = webResource.type("application/json").get(ClientResponse.class);
String user = response.getEntity(String.class);
System.out.print("user: "+user);
} catch (UniformInterfaceException ue) {
System.out.print(ue.getMessage());
}
}
</java>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2013 11:13 AM
(probably you need to url encode the %

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2013 04:02 AM

Are you able to confirm that it works for you in the demo rest war app?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2013 08:38 AM
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2013 09:59 AM

Thanks for the help!
