IPWorks Cloud 2020 Kotlin Edition

Questions / Feedback?

CreateAppKey Method

Creates a new application key.

Syntax

public fun createAppKey(keyName: String?, capabilities: String?, allowedBucketId: String?, allowedPrefix: String?, validityDuration: Long): String?

Remarks

This method creates a new application key named KeyName with the specified Capabilities. If successful, this method returns a string containing the newly-created application key's Id, followed by the key itself, separated by a newline (\n) character; for example:

[application_key_id]
[application_key]
Important: This is the only time that the application key's key string will be returned, be sure to save it immediately. It is not present in the results returned by the ListAppKeys method (this is a security feature enforced by the server).

The string passed for Capabilities must be formatted as a comma-separated list of one or more of the following:

Capability String Related Methods
deleteBuckets DeleteBucket
deleteFiles DeleteFile, DeleteFileVersion
deleteKeys DeleteAppKey
listBuckets GetBucketInfo, ListBuckets
listFiles DeleteFile, ListFiles, ListFileVersions, ListMultipartUploads
listKeys ListAppKeys
readFiles CopyFile, CopyPart, DownloadFile, DownloadFileById, GetFileInfo
shareFiles GetDownloadAuthToken
writeBuckets CreateBucket, UpdateBucket
writeFiles AbortMultipartUpload, CompleteMultipartUpload, CopyFile, CopyPart, HideFile, ListParts, StartMultipartUpload, UploadFile, UploadPart
writeKeys CreateAppKey

To restrict the new application key to a specific bucket, pass the bucket's Id for AllowedBucketId. To further restrict it to files with a specific prefix within that bucket, pass said prefix for AllowedPrefix. It is not possible to apply a prefix restriction without a bucket restriction.

The ValidityDuration parameter specifies how many seconds the new application key will be valid for. The maximum valid value is 86400000 (1000 days); values less than 1 will cause the application key to remain valid indefinitely.

The currently-authenticated application key must have the writeKeys capability to call this method successfully, otherwise the server will return an error. Refer to the Account.Capabilities field for more information.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Kotlin Edition - Version 20.0 [Build 7941]