Files
thijooree/docs/mibapi/10-activity-history.md
T
shihaam a8cd22cbe1
Auto Tag on Version Change / check-version (push) Failing after 13m32s
update docs
2026-06-13 21:30:12 +05:00

4.0 KiB

Activity History

Fetch the audit/activity log for the authenticated session. This is a separate feed from transaction history (04-history.md) — it records login events, profile switches, transfers initiated, beneficiary edits, etc.

Source: MibActivityHistoryClient.kt.


Endpoint

POST https://faisamobilex-wv.mib.com.mv/aProfile/getPagedActivityHistory

Authentication

WebView session cookies (see README) plus X-Requested-With: XMLHttpRequest.

Unlike most WebView AJAX calls, this endpoint sends no Referer and no Origin header.

Cookie: mbmodel=IOS-1.0; xxid=<session_xxid>; IBSID=<session_xxid>; mbnonce=<nonceGenerator>; time-tracker=597
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Linux; Android <ver>; wv) AppleWebKit/537.36 ...

Request Body (form-urlencoded)

Field Value Description
start 1 Start record index (1-based, inclusive)
end 100 End record index (inclusive)
includeCount 1 Return total_count in the response

The app uses a default page size of 100 (MibActivityHistoryClient.kt:120).


Response

{
  "success": true,
  "total_count": "248",
  "data": [
    {
      "aid": "A0001",
      "activityType": "Local Transfer",
      "pa": "You",
      "activity": "transferred MVR 100.00 to",
      "pb": "Ahmed Ali",
      "date": "16 May 2026 15:10"
    }
  ]
}
Field Description
success true on success
total_count Total entries on the server side (as a string — parse to int)
data Array of activity records

Record fields

Field Description
aid Activity ID — used as the notification ID for read-state tracking
activityType Category label (e.g. "Local Transfer", "Beneficiary Added", "Switch Profile", "Log in")
pa Subject — the actor, typically "You"
activity Verb phrase describing the action
pb Object — counterparty / target of the action
date Timestamp formatted "dd MMM yyyy HH:mm" in US locale (parsed with SimpleDateFormat("dd MMM yyyy HH:mm", Locale.US))

Display message

The app concatenates the three text fields with single spaces, skipping blanks:

message = "$pa $activity $pb"

E.g. "You transferred MVR 100.00 to Ahmed Ali".


Skipped Activity Types

The client hard-filters two activityType values out of the UI feed (MibActivityHistoryClient.kt:13):

private val SKIP_TYPES = setOf("Switch Profile", "Log in")

These records are still counted in total_count and still consume their slot in the requested [start, end] page. Pagination therefore has to fetch past them.


Pagination — fetchUntilEnough

Because hidden types reduce the effective yield of each page, a thin helper repeats fetchActivity until enough visible records are collected or all pages are exhausted (MibActivityHistoryClient.kt:116-134):

fun fetchUntilEnough(
    session: MibSession,
    loginId: String,
    minCount: Int = 5,
    pageSize: Int = 100
): FetchResult

Loop logic:

  1. Start at start = 1.
  2. Call fetchActivity(session, loginId, start, start + pageSize - 1).
  3. Append filtered items to the accumulator.
  4. Stop when either the accumulator has at least minCount items, or the raw page came back empty, or start + pageSize - 1 >= totalCount.
  5. Otherwise advance start += pageSize and repeat.

The returned FetchResult carries:

Field Description
items Filtered, ready-to-display notifications
rawCount Total raw items consumed from the server (pre-filter)
totalCount Server-reported total
nextStart Next start to use for further pagination

Failure

Any non-2xx response, JSON parse failure, or success: false is mapped to an empty FetchResult(emptyList(), 0, 0, end + 1) — failures are silent. The caller distinguishes "no data" from "transient failure" by inspecting totalCount.


 


← Contacts