Browse Source

fix(test-app): ensure afterId parameter is always included in API requests

The /api/v2/report/plansLastUpdatedBetween endpoint requires the afterId
parameter. When no previous jwtId is stored, default to "0" for the first
request. This ensures afterId is always present and never null/omitted.

Fix resolves "afterId parameter is required" API errors. Verified working:
prefetch execution shows request body includes afterId: "0" and API returns
HTTP 200 successfully.
master
Matthew Raymer 1 day ago
parent
commit
c4b7f6382f
  1. 9
      test-apps/daily-notification-test/android/app/src/main/java/com/timesafari/dailynotification/test/TestNativeFetcher.java

9
test-apps/daily-notification-test/android/app/src/main/java/com/timesafari/dailynotification/test/TestNativeFetcher.java

@ -178,7 +178,14 @@ public class TestNativeFetcher implements NativeNotificationContentFetcher {
// Build request body
Map<String, Object> requestBody = new HashMap<>();
requestBody.put("planIds", getStarredPlanIds());
requestBody.put("afterId", getLastAcknowledgedJwtId());
// afterId is required by the API endpoint
// Use "0" for first request (no previous data), or stored jwtId for subsequent requests
String afterId = getLastAcknowledgedJwtId();
if (afterId == null || afterId.isEmpty()) {
afterId = "0"; // First request - start from beginning
}
requestBody.put("afterId", afterId);
String jsonBody = gson.toJson(requestBody);
Log.d(TAG, "TestNativeFetcher: Request body: " + jsonBody);

Loading…
Cancel
Save