creating user with Rest API
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2013 04:15 AM
Hi,
I am trying to create new user in Activiti Engine through Rest API and i am calling "identity/users" Rest call for creating users.
I am passing below json from Enitity.
hp.setEntity(new StringEntity("{ \"id\":\"tijs\",\"firstName\":\"Tijs\",\"lastName\":\"Barrez\", \"email\":\"no-replyalfresco.org\",\"password\":\"pass123\"}", "UTF-8"));
I am getting below error response when above call is executed but no error on server side and user also not inserted.
{"errorMessage":"Unsupported Media Type","statusCode":415}
Please let me know solution for this.
regards,
suresh
I am trying to create new user in Activiti Engine through Rest API and i am calling "identity/users" Rest call for creating users.
I am passing below json from Enitity.
hp.setEntity(new StringEntity("{ \"id\":\"tijs\",\"firstName\":\"Tijs\",\"lastName\":\"Barrez\", \"email\":\"no-replyalfresco.org\",\"password\":\"pass123\"}", "UTF-8"));
I am getting below error response when above call is executed but no error on server side and user also not inserted.
{"errorMessage":"Unsupported Media Type","statusCode":415}
Please let me know solution for this.
regards,
suresh
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 04:06 AM
We have a test for creating users, see org.activiti.rest.service.api.identity.UserCollectionResourceTest:
Double-check if the JSON you create is valid. It's recommended that you use some kind of JSON framework, instead of creating the JSON's by hand. This is less error-prone and will guarantee valid syntax and escaping…
ObjectNode requestNode = objectMapper.createObjectNode();
requestNode.put("id", "testuser");
requestNode.put("firstName", "Frederik");
requestNode.put("lastName", "Heremans");
requestNode.put("password", "test");
requestNode.put("email", "no-reply@activiti.org");
ClientResource client = getAuthenticatedClient(RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION, "testuser"));
Representation response = client.post(requestNode);
assertEquals(Status.SUCCESS_CREATED, client.getResponse().getStatus());
Double-check if the JSON you create is valid. It's recommended that you use some kind of JSON framework, instead of creating the JSON's by hand. This is less error-prone and will guarantee valid syntax and escaping…
