Destinations API Components
This section details the available components and options available for use in the destinations API.
--Possible Transport + Format Destinations--
box_transport
Formats: pdf_format, word_format, xml_format, json_format, images_format
device_magic_transport
Formats: spreadsheet_format
dispatch_transport
Formats: xml_format
dropbox_transport
Formats: pdf_format, word_format, xml_format, json_format, images_format
email_transport
Formats: text_format, pdf_format, word_format, xml_format, json_format, images_format
evernote_transport
Formats: text_format, pdf_format, word_format, xml_format, json_format, images_format
google_drive_transport
Formats: spreadsheet_format, pdf_format, word_format, xml_format, json_format, images_format
google_spreadsheet_transport
Formats: spreadsheet_format
http_transport
Formats: xml_format, json_format, word_format, pdf_format
onedrive_transport
Formats: pdf_format, word_format, xml_format, json_format, images_format
s3_transport
Formats: pdf_format, word_format, xml_format, json_format, images_format
slack_transport
Formats: text_format, pdf_format, word_format, xml_format, json_format, images_format
sms_transport
Formats: text_format
sql_transport
Formats: xml_format
zapier_transport
Formats: xml_format, json_format (preferred)
--Possible Format + Binary Transport Destinations--
All formats except spreadsheet_format
Binary Transports: binary_none, binary_box_transport, binary_dropbox_transport, binary_google_drive_transport, binary_s3_transport
spreadsheet_format
Binary Transports: binary_device_magic_file_transport, binary_box_transport, binary_dropbox_transport, binary_google_drive_transport, binary_s3_transport
--Parameters--
Note: To send a file you need filename, file_data and content_type parameters.
e.g.
{
"pdf_format": {
"template_docx": {
"filename": "test_file.docx",
"content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"file_data": ...base 64 econded file data...
}
}
}
Formats:
text_format
pdf_format
word_format
spreadsheet_format
xml_format
json_format
images_format
No settings
Transports:
email_transport
device_magic_transport
No settings
http_transport
Note: Custom header keys and values are hashes paired by their keys in the hashes.
e.g.
{
"http_transport": {
"uri":"http://testurl.com",
"custom_header_keys":{
"1":"key1","2":"key2"
},
"custom_header_values":{
"1":"value1","2":"value2"
}
}
}
sms_transport
zapier_transport
s3_transport
dispatch_transport
Note: form_field_templates is an object hash containing the fields you want to pre-populate mapped to their values.
e.g.
{
"dispatch_form_id": 8,
"device_ids": ["iPhone_123-124-1234-xzc-35"],
"dispatch_transport": {
"form_field_templates": {
"Free_Text_Question": "Test",
"Decimal_Question": 25
}
}
}
Account Transports
The following transports need accounts to have been authorized / created in Device Magic. So first create a destination using the account you want to use for the API and then use the email in the component.
google_drive_transport
"shared_drive_id": "your-shared-drive-id-here"
google_spreadsheet_transport
box_transport
dropbox_transport
sql_transport
NOTE: delivery_column_templates is an object hash containing the columns you want to pre-populate mapped to their values.
Example:
{
"sql_transport": {
"adapter": "postgres",
"host": "your.server.hostname.or.ip.address",
"username": "your-username",
"password": "your-password",
"database_name": "your-database-name",
"port": "9000",
"table_name": "books",
"delivery_column_templates": {
"title": "{{fields.Book_title_}}",
"author": "{{fields.Book_author_}}",
"page_count": "{{fields.Page_count_}}"
}
}
}
Binary Transports:
binary_s3_transport
Binary Account Transports
The following transports need accounts to have been authorized / created in Device Magic. So first create a destination using the account you want to use for the API and then use the email in the component.
binary_google_drive_transport
binary_box_transport
binary_dropbox_transport
Destination Rules:
destination_conditions_json
is nested withindestination
Do not omit the format type, for example:
"pdf_format
" or"word_format"
Example:
{
"http_transport": {
"uri": "http://testurl.com",
"custom_header_keys": {
"1": "SubmittedDate",
"2": "ProjectNumber"
},
"custom_header_values": {
"1": "{{submitted_at}}",
"2": "AB1234"
}
},
"destination" : {
"destination_conditions_json": {
"condition": "AND",
"rules": [
{
"id": "metadata.submission_id",
"field": "metadata.submission_id",
"type": "number",
"input": "text",
"operator": "equal",
"value": "1"
}
]
}
},
"pdf_format": {}
}