Commit d6f7cc3
fix(SUPPORT-14907): handle future timestamps in pagination URLs
Fixes Facebook Pages API v2 returning 400/403 errors for post_insights
requests using insights.since(now).metric(...).
Root cause: Facebook returns paging.next URLs with Unix timestamps
pointing to the future, which fail with error: '(#100) since param is
not valid. Metrics data is available for the last 2 years.'
Changes:
- Add parse-unix-ts helper to parse 10-digit Unix timestamps
- Add extract-url-param helper to extract query params from URLs
- Add remove-url-param helper to remove query params from URLs
- Add handle-future-timestamps to process pagination URLs:
- If both since and until are in future -> skip (end of data)
- If only until is in future -> remove it, API uses 'now' implicitly
- Update get-next-page-url to use handle-future-timestamps
This fix is similar to the one applied in component-meta PR #19 for
Instagram insights.
Co-Authored-By: Zora Jelínková <zora.jelinkova@keboola.com>1 parent 21bff5c commit d6f7cc3
1 file changed
Lines changed: 46 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
14 | 55 | | |
15 | 56 | | |
16 | 57 | | |
| |||
121 | 162 | | |
122 | 163 | | |
123 | 164 | | |
| 165 | + | |
124 | 166 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
128 | 170 | | |
129 | 171 | | |
130 | 172 | | |
131 | 173 | | |
132 | | - | |
| 174 | + | |
133 | 175 | | |
134 | 176 | | |
135 | 177 | | |
| |||
0 commit comments