Example: Renaming a file¶
Frequency of use | Common |
---|---|
Trigger | User-initiated action, typically though the user-interface |
Pre-conditions |
|
Post-conditions |
|
Actors |
|
Communication Flow: Kotlin
Files.move.call(
bulkRequestOf(FilesMoveRequestItem(
conflictPolicy = WriteConflictPolicy.REJECT,
newId = "/123/my/new_file",
oldId = "/123/my/file",
)),
user
).orThrow()
/*
BulkResponse(
responses = listOf(LongRunningTask.Complete()),
)
*/
Communication Flow: Curl
# ------------------------------------------------------------------------------------------------------
# $host is the UCloud instance to contact. Example: 'http://localhost:8080' or 'https://cloud.sdu.dk'
# $accessToken is a valid access-token issued by UCloud
# ------------------------------------------------------------------------------------------------------
# Authenticated as user
curl -XPOST -H "Authorization: Bearer $accessToken" -H "Content-Type: content-type: application/json; charset=utf-8" "$host/api/files/move" -d '{
"items": [
{
"oldId": "/123/my/file",
"newId": "/123/my/new_file",
"conflictPolicy": "REJECT"
}
]
}'
# {
# "responses": [
# {
# "type": "complete"
# }
# ]
# }