- URL:
« /RestApi/UploadFile»
- Method:Â POST
- URL Params:
- authToken [string] [Required]=the authentication token
- fileName [string] [Required]=the name of the file that the user wants to upload
- objectName [string] [Required]=the name of the record’s object that the user wants to upload the file to
- fieldName [string] [Required]=the API name of the field that the file will be uploaded to
- RecGUID [long] [Required]=the record Id in CirrusShield that the file will be uploaded to
- Data Params:
- dataStream =the data of the uploaded file
Example:
// Get file name
$fileName = $_FILES['file_upl']['name'];
// Get file content
$data = file_get_contents($_FILES['file_upl']['tmp_name']);
// Transform file content to json array
$array = array();
foreach(str_split($data) as $char){
array_push($array, ord($char));
}
// Send the Data Params
curl_setopt($client, CURLOPT_POSTFIELDS, "=".json_encode($array));
<form name="file_up" action="UploadFile.php" method="POST" enctype="multipart/form-data">
Upload your file here
<input type="file" name="file_upl" id="file_upl"/>
<input type="submit" name="action" value="submit"/>
</form>
- Success Response :
- Status Code=200 (OK)
- Error Response:
- Status Code=400 (BadRequest) (in case there is an error in the json data sent in the HTTP Post Request body or if the object name, API field name in the object or record id are wrong)