diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index b620245e5..6b02693c1 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -47,6 +47,20 @@ function clickAPILink(apiLink) else window.open(currentLink); } +function clickAPILinkNotPretty(apiLink) +{ + var fixedQueryParams = "tenantIdentifier=default"; + var currentLink = baseURL + apiLink; + if (apiLink.indexOf("?") < 0) currentLink += "?" + fixedQueryParams; + else currentLink += "&" + fixedQueryParams; + + + if ((/MSIE (\d+\.\d+);/.test(navigator.userAgent)) || (apiLink.indexOf("exportCSV") > -1) || (apiLink.indexOf("type=CSV") > -1) || (apiLink.indexOf("type=XLS") > -1) ) + { // test for MSIE (not a great browser for the api docs anyhow) or a file download + location.href = currentLink; + } + else window.open(currentLink); +} function getBaseURL(docURL) { @@ -350,11 +364,10 @@ function getBaseURL(docURL)
Mifos X is a secure, multi-tenanted microfinance platform.
The goal of the Mifos X API is to empower developers to build apps on top of the Mifos X Platform. - The - reference Individual Lending app (user: mifos password: password) works on the same demo 'tenant' as the interactive links in this documentation.
+ The reference app (username: mifos, password: password) works on the same demo 'tenant' as the interactive links in this documentation.The API is organized around - REST. + REST.
The API is designed to have:
@@ -364,16 +377,15 @@ function getBaseURL(docURL)
HTTP verbs, which can be understood by off-the-shelf HTTP
clients.
JSON is returned in all responses from the API, including errors. +
JSON is returned in all responses from the API, including errors.
- Much of the API presentation and design ideas are owed to the excellent Apigee "Web API Design" eBook/PDF and the very good Stripe API reference. + Much of the API presentation and design ideas are owed to the excellent Apigee "Web API Design" eBook/PDF and the very good Stripe API reference.
- - +If you want to check out the POST, PUT and DELETE (update) examples a good approach is to take a moment to - install a REST plugin for your browser e.g. RESTClient for FireFox
+ install a REST plugin for your browser e.g. RESTClient for FireFox The REST plugins will allow you toParameter "fields={fieldlist}" can be used on GET requests to restrict the fields returned.
-Example Request:
-Normal Request:
+Request (restricting fields returned):
+Parameter "pretty=true" can be used to display JSON from GET requests in an easy-to-read format. This parameter is used in this documentation.
Easy-to-read JSON output for POSTs, PUTs and DELETEs will available in the REST plugin you use e.g. RESTClient for FireFox
+Normal Request (with pretty printing/formatting):
+Dates are returned in GET requests as an array e.g. [ 2007, 4, 11]. However, they are sent as strings in POST and PUT requests. - If there are any dates in your POST or PUT requests, you need to provide the "dateFormat". +
Dates are returned in GET requests as an array e.g. [ 2007, 4, 11]. However, the API accepts them as strings in POST and PUT requests. + If there are any dates in your POST or PUT requests, you need to provide the "locale" and "dateFormat". This can be any date pattern supported by Joda-Time. This capability can help you when saving data in your client application as you shouldn't need to do any date format conversion prior to issuing your POST or PUT request.
JSON examples:
{
+ "locale": "en_US",
"dateFormat": "dd MMMM yyyy",
"openingDate": "01 July 2007"
}
{
+ "locale": "en_US",
"dateFormat": "yyyy-MM-dd",
"openingDate": "2007-03-21"
}
@@ -3530,24 +3548,37 @@ Request Body:
POST https://Domain Name/api/v1/authentication?username={username}&password={password}
-POST authentication?username=super1&password=demo
+POST authentication?username=mifos&password=password
Content-Type: application/json
No Request Body
{
- "username": "super1",
- "userId": 2,
- "base64EncodedAuthenticationKey": "c3VwZXIxOmRlbW8=",
- "authenticated": true,
- "permissions": [
- "USER_ADMINISTRATION_SUPER_USER_ROLE",
- "REPORTING_SUPER_USER_ROLE",
- "PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE",
- "ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE"
- ]
+ "username": "mifos",
+ "userId": 1,
+ "base64EncodedAuthenticationKey": "bWlmb3M6cGFzc3dvcmQ=",
+ "authenticated": true,
+ "permissions": [
+ "ALL_FUNCTIONS"
+ ]
}
POST https://Domain Name/api/v1/authentication?username={username}&password={password}
+POST authentication?username=mifos&password=fail
+Content-Type: application/json
+No Request Body
+
+{
+ "developerMessage": "Invalid authentication details were passed in api request.",
+ "developerDocLink": "https://github.com/keithwoodlock/mifosx/wiki/HTTP-API-Error-codes",
+ "httpStatusCode": "401",
+ "defaultUserMessage": "Unauthenticated. Please login.",
+ "userMessageGlobalisationCode": "error.msg.not.authenticated",
+ "errors": []
+}
+
+