Developer Center

Attachments API

Last Updated: Oct 04, 2018 08:42AM CEST

URL

/api/documents/{ID}
/api/clients/{ID}/documents/
/api/groups/{ID}/documents/
/api/savings/{ID}/documents/
/api/loans/{ID}/documents/
/api/savingsProducts/{ID}/documents/
/api/loanProducts/{ID}/documents/
/api/branches/{ID}/documents/
/api/centres/{ID}/documents/
/api/users/{ID}/documents/

Description

Allows you to get, post or delete attachments.

Methods

GET Attachments

Allows retrieving a list of documents descriptions based on the owner id/key or allows retrieving the content of a document encoded with base64 based on the document id/key. The list of document descriptions can be paginated

Usage examples

//get documents for client with id 1
GET /api/clients/1/documents?offset=0&limit=5

//get paginated  documents for client with id 1
GET /api/clients/1/documents

//get documents for client with encoded key 8a13732d44cd56800144cf0311550077 
GET /api/clients/8a13732d44cd56800144cf0311550077/documents

//get documents for group with id 2
GET /api/groups/2/documents

//get documents for a loan account with id 3
GET /api/loans/3/documents

//get documents for a savings account with id 2344
GET /api/savings/2344/documents

//get documents for a loan product with id LDP
GET /api/loanProducts/LDP/documents

//get documents for a savings product with id SDP
GET /api/savingsProducts/SDP/documents

//get documents for branch with id b123
GET /api/branches/b123/documents

//get documents for centre with id c123
GET /api/centres/c123/documents

//get documents for user with username demo
GET /api/users/demo/documents

//get document content encoded in base64 for document with id 10
GET /api/documents/10

//get document content encoded in base64 for document with encoded key 8a13732d44bde36e0144bfc1e74100a9 
GET /api/documents/8a13732d44bde36e0144bfc1e74100a9

Samples responses:

//response containing the list of documents for a client
[
    {
    "encodedKey":"8a13732d44cd56800144cf86625d01e7",
    "id":59,
    "creationDate":"2014-03-17T10:11:34+0000",
    "lastModifiedDate":"2014-03-17T10:11:34+0000","
    "documentHolderKey":"8a13732d44bde36e0144bfbf7e41009b",
    "documentHolderType":"CLIENT",
    "name":"post_document_1",
    "type":"txt",
    "fileSize":115,
    "originalFilename":"post_document_1",
    "location":"8a13732d44cd56800144cf86625d01e7",
    "createdByUserKey":"8a33ae49441c4fe101441c5fe42f0005",
    "userName":"Max Power"
    },
    {
    "encodedKey":"8a13732d44c07fb80144c0aff4e2009d",
    "id":41,
    "creationDate":"2014-03-14T13:02:40+0000",
    "lastModifiedDate":"2014-03-14T13:02:40+0000",
    "documentHolderKey":"8a13732d44bde36e0144bfbf7e41009b",
    "documentHolderType":"CLIENT",
    "name":"internal_demo",
    "type":"txt",
    "fileSize":131,
    "originalFilename":"internal_demo",
    "location":"8a13732d44c07fb80144c0aff4e2009d",
    "createdByUserKey":"8a33ae49441c4fe101441c5fe42f0005",
    "userName":"Max Power"
    }
]

//response containing the document content encoded in base64
"ZmlsZSBjb250ZW50"
Note: Mambu returns tne content of the attachment as a Base64 string with quotes. In order to decode in pieces, these quotes would need to stripped first. 

POST Attachments

Allow for POST attachments to a client or account. The request should include a JSON encoding of the data being pushed which includes within it the documentHolderType and documentHolderKey (eg CLIENT) as well as the base64 encoded document body.

Parameters

documentHolderKey The attachment holder encoded key. Required
documentHolderType The attachment holder type. Required. Possible values:
  • CLIENT
  • GROUP
  • LOAN_ACCOUNT
  • LOAN_PRODUCT
  • DEPOSIT_ACCOUNT
  • SAVINGS_PRODUCT
  • BRANCH
  • CENTRE
  • USER
name The attachment file name(maximum 256 characters). Maximum one extension must be provided in the name(could be none). If the extension is provided it must match with the one provided in the type parameter.Required.
Some special characters are not allowed in the filename, these are:
/ < > | : & ? * [ ] # \ " '
type The attachment file extension type(example doc). Required.
Allowed extensions:
JPG,JPEG,PNG,GIF,BMP,TIFF,DOC,DOCX,DOCM,DOT,DOTX,
DOTM,XLS,XLSX,XLSB,PPTX,PPT,PPS,PPSX,ODT,OTT,FODT,
PDF,XML,TXT,CSV,PROPERTIES,MSG,TIF,ZIP,RTF,XLSM,ODS,
ODP,EML,EMLX,HTML,MHT,MHTML,XPS,NUMBERS,KEY,
PAGES,YAML,JSON,JASPER,JRXML
documentContent Base64 encoded document body(maximum 15 MB size). Required

Usage examples

//POST a document with the file name "client_information" for a client with encoded key 40288a0c3e3cfb4e013e3d00bb9c00df
{
    "document":{
    "documentHolderKey":"40288a0c3e3cfb4e013e3d00bb9c00df",
    "documentHolderType":"CLIENT",
    "name":"client_information",
    "type":"doc"
    },
    " documentContent":"[base64encodedString]"
}

//POST a image with the file name "john_photo" for a USER with encoded key 40288a0c3e3cfb4e013e3d00bbzxcvs
{
    "document":{
    "documentHolderKey":"40288a0c3e3cfb4e013e3d00bbzxcvs",
    "documentHolderType":"USER",
    "name":"john_photo",
    "type":"jpg"
    },
    " documentContent":"[base64encodedString]"
}

Samples responses:

//response for posting a document for a CLIENT that also includes a generated document id and encoded key
{
    "encodedKey":"8aa0f78f444f763601444f7fb89e0001",
    "id":1,
    "creationDate":"2014-02-20T13:32:54+0000",
    "lastModifiedDate":"2014-02-20T13:32:54+0000",
    "documentHolderKey":"8a33ae49441c4fe101441c7149cb00fe",
    "documentHolderType":"CLIENT",
    "name":"document",
    "type":"doc",
    "fileSize":14,
    "originalFilename":"document",
    "location":"8aa0f78f444f763601444f7fb89e0001",
    "createdByUserKey":"8a33ae49441c4fe101441c5fe42f0005"
}

DELETE attachments

Allows the deletion of attachments based attachment id/encoded key

Usage example

//delete attachment with id 1
DELETE /api/documents/1

//delete attachment with encoded key 8aa0f78f444f763601444f7fb89e0001
DELETE /api/documents/8aa0f78f444f763601444f7fb89e0001

Response

A success return code will be returned when the deletion is successful.
{
    "returnCode":0,
    "returnStatus":"SUCCESS"
}
support@mambu.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete