Dropbox

This s a documentation page for our shiny new REST API - you weren't meant to find it. This API isn't ready for public use yet. We're chopping and changing it a LOT as we grow it. So if you build something that uses it then it's very likely to break in a future update. Don't say you weren't warned!

URL:

https://api.kashflow.com/v2/{objecttype}/{objectnumber}/files

Method(s):

get,post,delete

Response Formats:

JSON, XML

Description:

These methods allow you to list, upload and delete Dropbox file(s).
{objecttype} in the URL can be substituted by one of the below entities to which the Dropbox files belong.
{objectnumber} in the URL is the identifier (mentioned below) of the entity to which Dropbox files belong.

{objecttype}{objectnumber}
QuotesQuote Number
InvoicesInvoice Number
PurchasesPurchase Number
CustomersCustomer Code
BankAccountsBank Account Name

So, the GET of URL /invoice/100/files would return the Dropbox files belonging to invoice number 100.

Parameters

NameTypeDescription
IconStringThe icon name for a file. This uniquely identifies the image file that needs to be used to represent the file.
NameStringName of the file
LastModifiedDateDateThe date on which the file was last modified. For e.g. [JSONDATE]
SizeInBytesNumericSize of the file in bytes
SizeToBeDisplayedSizeSize of the file to be displayed on UI
IsThumbnailAvailableBooleanWhether a minified version of the file is available. At present, we support such a version for “jpg”, “jpeg”, “png”, “tiff”, “tif”, “gif” and “bmp” file formats. So, only for these files, the value of this field is ‘true’
FileUriStringSigned Uri which gets the file bits.
ThumbnailUriStringSigned Uri which gets the file bits for the minified version of the file, if available.

Configuring dropbox for a kashflow user Operation

URL : /dropbox/authentication

Example response for GET


"https:\/\/www.dropbox.com\/1\/oauth\/authorize?oauth_callback=https%3A%2F%2Fapi.kashflow.com%2Fv2%2Fdropbox%2Fauthentication%2Furl%3Fkashflowuserid%3D93951%26userguid%3DB40CFB55-A9D4-446F-A373-DB283EC57299&oauth_token=0oC86SFXU6GHzqaA"

The returned url should be used within 5 minutes. If the client is to be redirected to a new location then querystring redirecturl={redirecturl} should be appended to the url.

GET Operation

Provides access to dropbox account

URL : /dropbox/authentication/url?kashflowuserid={kashflowuserid}&uid={uid}&userguid={userguid}&oauth_token={oauthtoken}&redirecturl={redirecturl}

Example response for GET

Status Code: 200

If redirect url is specified then the client will be redirected to the specified url after providing kashflow account access to dropbox. If redirect url is not specified then a status code of 200 will be returned after allowing kashflow account access to dropbox.

GET of file list
Returns all the Dropbox files associated with a particular entity object for the authenticated user.

URL : /{objecttype}/{objectnumber}/files

Example response for GET of Dropbox file


[{
  "Icon": "page_white_picture",
  "Name": "76643107_13e683ad6f.jpg",
  "SizeInBytes": 164391,
  "SizeToBeDisplayed": "160.5 KB",
  "LastModifiedDate": "2008-03-11 12:00:00",
  "IsThumbnailAvailable": true,
  "ThumbnailUri": "https:\/\/api-content.dropbox.com\/1\/thumbnails\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D",
  "FileUri": "https:\/\/api-content.dropbox.com\/1\/files\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D"
},{
  "Icon": "page_white_picture",
  "Name": "76643107_13e683ad6f.jpg",
  "SizeInBytes": 164391,
  "SizeToBeDisplayed": "160.5 KB",
  "LastModifiedDate": "2008-03-11 12:00:00",
  "IsThumbnailAvailable": false,
  "ThumbnailUri": "",
  "FileUri": "https:\/\/api-content.dropbox.com\/1\/files\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D"
}]

GET of single file
Returns the Dropbox file information associated with the particular file of the entity object for the authenticated user.

URL : /{objecttype}/{objectnumber}/files/{filename}

{filename} is the name of the file to be fetched.

Example response for GET of Dropbox file list


{
  "Icon": "page_white_picture",
  "Name": "76643107_13e683ad6f.jpg",
  "SizeInBytes": 164391,
  "SizeToBeDisplayed": "160.5 KB",
  "LastModifiedDate": "2008-03-11 12:00:00",
  "IsThumbnailAvailable": true,
  "ThumbnailUri": "https:\/\/api-content.dropbox.com\/1\/thumbnails\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D",
  "FileUri": "https:\/\/api-content.dropbox.com\/1\/files\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D"
}

DELETE Operation

Deletes a file with the specified file name for the given entity object (type and identifier specified in URL).

URL : /{objectType}/{objectNumber}/files/{filename}

{filename} is the name of the file to be deleted.

POST Operation

Uploads file to dropbox.

URL for Invoice : /invoices/files
URL for Quotes : /quotes/files
URL for Purchases : /purchases/files
URL for Customers : /customers/files
URL for BankAccounts : /bankaccounts/files

Email attachment creation involves HTTP multi-part POST operation.
Example code snippet for posting a file is shown below.

Code snippet of POST


<form action="http://{domainUrl}/invoices/files" enctype="multipart/form-data" method="post">
  <input id="sessiontoken" type="hidden" name="sessiontoken" value="{sessiontoken}" /> 
  <input id="number" type="hidden" name="number" value="{number}" /> 
  <input class="txtBox" id="fileToUpload" type="file" name="file" /> 
  <input type="submit" value="Upload File" />
</form>

In this case {sessiontoken} is session token which is obtained after successful authentication and {number} is invoice/quote/receipt number.
The selected file will be uploaded to dropbox.

In case of customers
<input id=”number” type=”hidden” name=”number” value=”{number}” />
should be replaced with
<input id=”code” type=”hidden” name=”code” value=”{customercode}” />

In case of bank account
<input id=”number” type=”hidden” name=”number” value=”{number}” />
should be replaced with
<input id=”code” type=”hidden” name=”code” value=”{bankAccountName}” />

Note : Sequence of the fields specified in the given code snippet should be maintained.

Sending PDF file to Dropbox

To upload a specific PDF file for a quote/invoice/purchase to Dropbox.

URL for Invoice : /invoices/files/{number}
URL for Quotes : /quotes/files/{number}
URL for Purchases : /purchases/files/{number}

{number} in the URL will be replaced by unique number assign to entity

Note : this is a post request without body.

Example response for Send file to Dropbox


{
  "Icon": "page_white_picture",
  "Name": "76643107_13e683ad6f.jpg",
  "SizeInBytes": 164391,
  "SizeToBeDisplayed": "160.5 KB",
  "LastModifiedDate": "2008-03-11 12:00:00",
  "IsThumbnailAvailable": true,
  "ThumbnailUri": "https:\/\/api-content.dropbox.com\/1\/thumbnails\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D",
  "FileUri": "https:\/\/api-content.dropbox.com\/1\/files\/sandbox\/Invoices\/4455\/76643107_13e683ad6fnw123.jpg?oauth_consumer_key=skewpon3lk0h3ft&oauth_nonce=13717885376D02A920D0E24074867CF0D752EAB7CB&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1371788537&oauth_token=4u58uefwbm4e6kr&oauth_signature=3%2FdLVsCIudp3fD2ZimlNlwatFzI%3D"
}

See how IRIS KashFlow works with your business and your books