From c4b7f6382f3634f4245f81a6d93512f0bf363a6a Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sun, 2 Nov 2025 09:58:41 +0000 Subject: [PATCH] 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. --- .../dailynotification/test/TestNativeFetcher.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test-apps/daily-notification-test/android/app/src/main/java/com/timesafari/dailynotification/test/TestNativeFetcher.java b/test-apps/daily-notification-test/android/app/src/main/java/com/timesafari/dailynotification/test/TestNativeFetcher.java index c9ba55b..8de562b 100644 --- a/test-apps/daily-notification-test/android/app/src/main/java/com/timesafari/dailynotification/test/TestNativeFetcher.java +++ b/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 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);