Method: Identify Templates
Description
Certain files such as certificates have special integrations which can be taken advantage of if the file is stored under the appropriate template.
The filecollect endpoint parses the file and returns the appropriate StoredSafe template.
Unlike other endpoints, which take in JSON data, this endpoint takes multipart form data as input.
URL Syntax
/api/{version}/filecollect
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. |
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.status |
SUCCESS or FAIL |
String |
CALLINFO.token |
StoredSafe token to be used in subsequent calls |
String |
HEADERS |
HTTP Headers |
Object |
DATA.token |
Supplied token in API-call |
String |
DATA.templateid |
Returned templateid based on file |
Number |
STRUCTURE |
Template structure |
Object |
PARAMS |
PARAMS (empty) |
Array |
Examples
Get the suggested templateid of a file called hello.txt. The request example uses syntax similar to curl to specify parameters.
Request
POST /api/1.0/filecollect
x-http-token: your_storedsafe_token
content-type: multipart/form-data
-F upload=@hello.txt
Response
HTTP/2 200
Content-type: application/json; charset=UTF-8
{
"STRUCTURE": {
"file1": {
"translation": "File",
"type": "file",
"encrypted": false,
"show": true,
"policy": false,
"alarm": false,
"opt": false,
"cc": false,
"nc": false,
"val": "",
"alarmed": "",
"ischanged": false
},
"description": {
"translation": "Description",
"type": "text",
"encrypted": false,
"show": true,
"policy": false,
"alarm": false,
"opt": true,
"cc": false,
"nc": false,
"val": "",
"alarmed": "",
"ischanged": false
}
},
"DATA": {
"token": "your_storedsafe_token",
"templateid": 3
},
"HEADERS": {
"Content-Type": "multipart/form-data",
"Content-Length": "202",
"X-Http-Token": "your_storedsafe_token",
"Accept": "*/*",
"User-Agent": "curl/7.81.0",
"Host": "safe.domain.cc"
},
"PARAMS": [],
"CALLINFO": {
"errors": 0,
"errorcodes": 0,
"general": [],
"handler": "FilecollectHandler",
"status": "SUCCESS",
"token": "rotated_storedsafe_token"
}
}