The PutFiles service allows you to send files to your Flexmail accounts. You can send Images and/or Documents.
SOAP Action: PutFiles
SOAP Return Object: PutFilesResp
The following table describes the parameters used for calling the PutFiles service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
fileTypeItems | Y | Array of FileType | Files to put |
The following table describes the parameters returned from the PutFiles service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | / | APIResponseHeader | Header containing authentication information |
errorCode | / | Integer | Numerical value of the error |
errorMessage | / | String | Short literal description of the error |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | No files to upload |
222 | An Error Occured for at least one file |
This example shows you how to put one image and one document in your Flexmail account.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $files = array(); $image = new stdClass(); $image->type = "Image"; $image->name = "MyImage.jpg"; $image->data = base64_encode(file_get_contents("MyImage.jpg")); $files[] = $image; $doc = new stdClass(); $doc->type = "Document"; $doc->name = "MyDocument.doc"; $doc->data = base64_encode(file_get_contents("MyDocument.doc")); $files[] = $doc: $putFilesReq->header = $header; $putFilesReq->fiels = $files; $putFilesResp = $SoapClient->__soapCall("PutFiles", array($putFilesReq)); if ($putFilesResp->errorCode == 0) { echo "All files put successfull"; } else { echo "Put Files failed"; } ?>