Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
2.4.0
-
None
Description
When using REST for a group insert, a group name is required in the URL, but it's also required in the request body. The one in the URL is not needed, and can be a non-existent group. However, it can't be left out, so something needs to be there as a placeholder.
1) Putting the desired group name in the URL and leaving it out of the request object:
PUT /groups/unc:app:temp:cer28:test-create-group
{
"WsRestGroupSaveLiteRequest":{
"saveMode":"INSERT",
"displayExtension":"test-create-group",
"description":"description"
}
}
Result: java.lang.RuntimeException: Group name must exist and must contain at least one stem name (separated by colons): 'null'
2) Putting a fake name in the URL and putting the groupName in the body works
PUT /groups/fake-group-that-doesnt-exist
{
"WsRestGroupSaveLiteRequest":{
"saveMode":"INSERT",
"groupName":"unc:app:temp:cer28:test-create-group",
"displayExtension":"test-create-group",
"description":"description"
}
}
Result => SUCCESS_INSERTED
The resource key in the URL is for groupLookupName, which maps to GroupSave.assignGroupNameToEdit() when saving the group. This is only valid for updates. Changing INSERT to UPDATE in both of the above examples works as long as the group exists.
Either POST /groups (groupName in body) or POST /groups/:groupName (groupName not in body), or both, could be viable options for creating a group. The only thing stopping the former is that the implementation doesn't allow blanks. The latter may also be easy to fix, by manipulating the request object.