Method: Upload Files

Description

Create a new File Object in an existing Vault.

A user can create a File Object in a Vault, if the following conditions are met:

  • The user has been assigned Write permission in the Vault by the Data Custodian (a user with the Admin capability) of the Vault.

  • The StoredSafe instance is licensed for File use.

Unlike other endpoints, which take in JSON data, this endpoint takes multipart form data as input.

For more information about selecting the appropriate template, see Identify Templates.

URL Syntax

/api/{version}/object

HTTP Method

POST

Successful HTTP Response

200

Parameters

Parameter name

Description

Parameter type

Type

Mandatory

Comment

X-Http-Token

StoredSafe token

HTTP Header

String

file

File being uploaded

Multipart

File

Parameter name may differ depending on HTTP client.

templateid

Template-ID

JSON-encoded

String

Yes

groupid

Vault-ID

JSON-encoded

String

Yes

parentid

Parent-ID

JSON-encoded

String

Yes

Response Attributes

Attribute

Description

Type

CALLINFO.errorcodes

Number of errors

Integer

CALLINFO.errors

Number of errors

Integer

CALLINFO.general

Information

Array

CALLINFO.handler

Handler used

String

CALLINFO.objectid

Assigned Object-ID

Integer

CALLINFO.status

SUCCESS or FAIL

String

CALLINFO.message

Any message from handler (if successful)

String

CALLINFO.token

StoredSafe token to be used in subsequent calls

String

HEADERS

HTTP Headers

Object

DATA

Supplied data in API-call

Object

PARAMS

PARAMS (empty)

Array

Examples

Create a new file object in Vault-ID 6319fd25876b469c76164 for the file hello.txt. The request example uses syntax similar to curl to specify parameters.

Request

POST /api/1.0/object
x-http-token: your_storedsafe_token
content-type: multipart/form-data
-F upload=@hello.txt
-F groupid=6319fd25876b469c76164
-F parentid=0
-F templateid=3

Response

HTTP/2 200
{
    "DATA": {
        "templateid": "3",
        "groupid": "6319fd25876b469c76164",
        "parentid": "0",
        "token": "your_storedsafe_token"
    },
    "HEADERS": {
        "Content-Type": "multipart/form-data; boundary=------------------------f51573f6ee30d991",
        "Content-Length": "517",
        "X-Http-Token": "your_storedsafe_token",
        "Accept": "*/*",
        "User-Agent": "curl/7.81.0",
        "Host": "chili.dev.xpd.se"
    },
    "PARAMS": [],
    "CALLINFO": {
        "token": "rotated_storedsafe_token",
        "objectid": "63f8d06437b26deabfa16",
        "message": "Object successfully saved",
        "general": [],
        "handler": "ObjectHandler",
        "status": "SUCCESS",
        "errors": 0,
        "errorcodes": 0
    }
}