Sharing bulk update api #317
Replies: 4 comments 2 replies
-
I think the other possible format we talked about would look something like this: {
"dataSets":[
"cYeuwXTCPkU",
"aYeuwXTCPkU"
],
"patch":[
{
"op":"add",
"path":"/sharing/users/DXyJmlo9rge",
"value":{
"access":"rw------",
"id":"DXyJmlo9rge"
}
},
{
"op":"remove",
"path":"/sharing/users/N3PZBUlN8vq"
}
]
} In java this could be modelled as class BulkJsonPatch {
Map<Class<?>,List<String>> targetUids;
JsonPatch patch;
} JSON to Java mapping could be done with help of Plus:
Minus:
I think @mortenoh suggested something like the following to also allow different operations: {
"dataSets":[
{
"cYeuwXTCPkU":[
{
"op":"add",
"path":"/sharing/users/DXyJmlo9rge",
"value":{
"access":"rw------",
"id":"DXyJmlo9rge"
}
},
{
"op":"remove",
"path":"/sharing/users/N3PZBUlN8vq"
}
]
},
{
"aYeuwXTCPkU":[...]
}
],
"dataElements":[...]
} The outer wrapper then could be: class BulkJsonPatch {
Map<Class<?>, Map<String, JsonPatch>> patches;
} I think this has all the benefits of the solution for same operation on all objects and does not have the drawback that it cannot model different changes on different objects. However this also means if what you really wanted is the same operation on all objects and those are lots of objects this payload gets very big compared to the same operation version. This could be an argument to allow even both variants. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Sounds like a good idea. On the path the nicest solution for the user would be to just have |
Beta Was this translation helpful? Give feedback.
-
This has been implemented. Check this api document for more details. |
Beta Was this translation helpful? Give feedback.
-
Requirement
Endpoints
Using
/api/{object-type}/sharing
withPATCH
requestapi/{object-type}/{uid}
. Without path variableuid
the request will be treated as a bulk patch request.Example:
api/dataElements/sharing
Using
/api/metadata/sharing
withPATCH
requestPATCH
request for multiple object-types in one payload. This could be a new feature in Metadata Import/Export app.Parameters
Otherwise, if this is false then the function will try to proceed with best effort mode.
Backend function
batch
method toAbstractCrudController
for servingPATCH
request toapi/{object-type}/
Validation
Response
/api/metadata
api.Payload
/api/{object-type}/sharing
looks like thisapi/metadata/sharing
Bonus
Beta Was this translation helpful? Give feedback.
All reactions