Skip to main content

Posting Data

API requests that post data can either use URL-encoded query parameters or a JSON body to enter data. The Content-Type header must be set to application/json for the JSON request.

warning

GET andPOST requests using query parameters should always use url-encoding for parameter values to make sure any special characters are properly escaped and do not cause errors or loss of information.

The examples to the right, show the two methods for posting data. Note that for some requests, much more information can be posted using the JSON input than is available with query parameters.

Using query parameters

curl -d "type=APPROVAL" https://user:pword@test.mambu.com/api/loans/4028329c3ad6c515013ad6d0f6e40006/transactions

Using JSON:

curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{ "type": "APPROVAL"} https://user:pword@test.mambu.com/api/loans/4028329c3ad6c515013ad6d0f6e40006/transactions`

Example

The example to the right makes a request using the username user, the password pword to the tenant demo to retrieve all repayments for loan account abc

Request with authorization made ...

https://user:pword@demo.mambu.com/api/loans/abc/repayments

And returns a response such as:

[
{
"encodedKey": "402832b4380a2d8801380a9cac860010",
"parentAccountKey": "402832b4380a2d8801380a9cac41000f",
"dueDate": "2012-07-28T00:00:00+0200",
"principalDue": "190",
"principalPaid": "0",
"interestDue": "25.45",
"interestPaid": "0",
"state": "PENDING"
},
{
"encodedKey": "402832b4380a2d8801380a9cac870011",
"parentAccountKey": "402832b4380a2d8801380a9cac41000f",
"dueDate": "2012-08-28T00:00:00+0200",
"principalDue": "190",
"principalPaid": "0",
"interestDue": "26.29",
"interestPaid": "0",
"state": "PENDING"
}
]
Using theAuthorization header

You can alternatively supply your username and password directly via theAuthorization header in the formatBasic {base64-encoded-string} wherebase64-encoded-string is the base 64 encoded value of your username and password separated by a colon ':', iedXNlcm5hbWU6cGFzc3dvcmQ= would be the result forusername:password.