...
Single Attachment Actions
readAttachment
Info |
---|
This API call returns an array containing a dictionary with the Attachment object matching the Id specified. Important returned fields: Body – base64 encoded attachment data (if ReturnBase64Data is not false )
ThumbBody – base64 encoded attachment thumbnail data (if ReturnBase64Data is not false and attachment is an image)
FileURL – local URL to the attachment file
ThumbURL – local URL to the attachment thumbnail file (empty string if attachment is not an image)
Related Pulsar Settings: |
...
Note |
---|
The queryAttachment API call will NOT return the Attachment's Base64 Body field or the Base64 data representing the thumbnail. |
createAttachmentFromCamera
Info |
---|
The createAttachmentFromCamera method allows creation of Attachments directly from the device's camera. The intended Attachment ParentId is a required argument. Optionally, you can specify a file name for the attachment, instead of using the name of the original file. On success, the response data contains the Id of the created attachment. |
Code Block |
---|
var request = {
"type" : "createAttachmentFromCamera",
"data" : {
"ParentId" : "001234567891234", // Required
"Name" : "AttachmentName.jpg" // Optional
}
};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createAttachmentResponse") {
alert('Created Attachment Id: ' + responseData.data);
}
else {
// error code
}
}); |
Create Actions on Multiple Attachments (recommended v14+)
createBatchResponse returned from batch endpoints
All of the following endpoints return a response in the format below. The response below is simplified for brevity.
Full Success – all files saved
Code Block |
---|
{
"type": "createbatchResponse",
"object": "Attachment",
"data": {
"summary": { "success": "TRUE" },
"results": {
"0": {
"objectId": "CURIUM_1111111111_1", // this could also be an 069 ContentDocumentId if performed online.
"success": "TRUE",
"FileURL": "http://127.0.0.1:17014/datacache/FileName1.jpg"
},
"1": {
"objectId": "CURIUM_222222222_2", // this could also be an 069 ContentDocumentId if performed online.
"success": "TRUE",
"FileURL": "http://127.0.0.1:17014/datacache/FileName2.jpg"
}
}
}
} |
Partial Success – some files saved
Code Block |
---|
{
"type": "createbatchResponse",
"object": "Attachment",
"data": {
"summary": { "success": "FALSE" },
"results": {
"0": {
"objectId": "CURIUM_1111111111_1", // this could also be an 069 ContentDocumentId if performed online.
"success": "TRUE",
"FileURL": "http://127.0.0.1:17014/datacache/FileName.jpg"
},
"1": {
"success": "FALSE",
"error": "...error message from API for this file... |
...
createAttachmentBatch
Anchor |
---|
| createattachmentbatch |
---|
| createattachmentbatch |
---|
|
Info |
---|
The createAttachment createAttachmentBatch method allows creation of multiple Attachments directly from Base64 encoded data. The intended Attachment ParentIdAn array of objects with their intended parent SObject Id (ParentId), Name, and Body are required arguments. The ContentType of the Attachment File may be optionally specified in MIME type format, as in the example below. On success, the response data contains the Id of the created attachmentAttachment. |
Code Block |
---|
var request = {
"type" : "createAttachmentcreateAttachmentBatch",
"data" : [
{
"ParentId" : "001234567891234", // Required
// Required
"Name" : "AttachmentNameFileName.jpg", // Required
// Required "Body" : "AABBCCDDEEFF...", // Base64 data -- Required
"ContentType" : "image/jpeg" // Optional -- manual entry of content type
}
} },
{ ... },
{ ... },
]};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createAttachmentResponsecreatebatchResponse") {
alert('Created Attachment Id: ' + responseData.data);
}
else {
// process results
}
else {
// error code
}
}); |
...
createAttachmentFromFilePathBatch
Anchor |
---|
| createattachmentfromfilepathbatch |
---|
| createattachmentfromfilepathbatch |
---|
|
Info |
---|
The createAttachmentFromFilePath createAttachmentSFFileFromFilePathBatch method allows creation of multiple Attachments directly from valid, accessible, device file paths. The intended Attachment ParentId, FilePath An array of objects with their intended parent SObject Id (ParentId), Name, and Body are required arguments. The ContentType of the Attachment File may be optionally specified in MIME type format, as in the example below. Optionally, you can specify a file name for the attachment, instead of using the name of the original file. On success, the response data contains the Id of the created attachmentAttachment. |
Code Block |
---|
var request = {
"type" : "createAttachmentFromFilePathcreateAttachmentFilePath",
"data" : {
"ParentId" : "001234567891234", // Required
"Name" : "AttachmentNameFileName.jpg", // Optional
"ContentType" : "image/jpeg", // Optional -- manual entry of content type
"FilePath" : "/Valid/Path/To/File.Jpg" // Required
}
};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createbatchResponse") {
// process results
}
else {
// error code
}
}); |
Create Actions on Single Attachments
createAttachment
Info |
---|
The createAttachment method allows creation of Attachments directly from Base64 encoded data. The intended Attachment ParentId, Name, and Body are required arguments. The ContentType of the Attachment may be optionally specified in MIME type format, as in the example below. On success, the response data contains the Id of the created attachment. |
Note |
---|
Multiple create or delete requests MUST NOT run concurrently. If you need to create multiple attachments, it is recommend you using the createAttachmentBatch endpoint to avoid the effort of using callbacks and/or promises with .then() for continuations. |
Code Block |
---|
var request = {
"type" : "createAttachment",
"data" : {
"ParentId" : "001234567891234", // Required
"Name" : "AttachmentName.jpg", // Required
"Body" : "AABBCCDDEEFF...", // Base64 data -- Required
"ContentType" : "image/jpeg" // Optional -- manual entry of content type
}
};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createAttachmentResponse") {
alert('Created Attachment Id: ' + responseData.data);
}
else {
// error code
}
}); |
...
createAttachmentFromFilePath
Info |
---|
The createAttachmentFromCamera createAttachmentFromFilePath method allows creation of Attachments directly from the device's cameravalid, accessible, device file paths. The intended Attachment ParentId is a required argument. Optionally, FilePath are required arguments. The ContentType of the Attachment may be optionally specified in MIME type format, as in the example below. Optionally, you can specify a file name for the attachment, instead of using the name of the original file. On success, the response data contains the Id of the created attachment. |
Note |
---|
Multiple create or delete requests MUST NOT run concurrently. If you need to create multiple attachments, it is recommend you using the createAttachmentFromFilePathBatch endpoint to avoid the effort of using callbacks and/or promises with .then() for continuations. |
Code Block |
---|
var request = {
"type" : "createAttachmentFromCameracreateAttachmentFromFilePath",
"data" : {
"ParentId" : "001234567891234", // Required
"Name" : "AttachmentName.jpg", // Optional
"NameContentType" : "AttachmentName.jpg"image/jpeg", // Optional -- manual entry of content type
"FilePath" : "/Valid/Path/To/File.Jpg" // Required
}
};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createAttachmentResponse") {
alert('Created Attachment Id: ' + responseData.data);
}
else {
// error code
}
}); |