Network Refresh
Network Refresh is the fast, tab-free method for updating all cached courses at once. Instead of opening a browser tab per course and waiting for the DOM to load, it calls the Infinite Campus REST API directly from the extension's background service worker, returning all quarters' grade data in a single response per course.
Overview
When you click Refresh All (or the refresh button) in the Dashboard, a pre-flight dialog appears that lets you choose how to refresh. Two strategies are available:
| Strategy | How it works | Requirements |
|---|---|---|
| Network Refresh | Calls the IC API directly. No browser tabs are opened. Completes in seconds per course. Retries automatically on failure. | Must be signed in to Infinite Campus in the same browser profile. |
| Classic Refresh | Opens each course URL in a background tab, waits for the page to load, scrapes the DOM, then closes the tab. Slower and more disruptive. | Must be signed in to Infinite Campus in the same browser profile. |
Both strategies require an active Infinite Campus session. If you are not signed in, both buttons are disabled.
Pre-Flight Dialog
Before any refresh starts, the dialog:
Checks your session by calling
${base}/resources/my/userAccount. The result is shown immediately:- ✅ Session verified. Signed in as [First Last]. - green badge
- ✗ You are not currently signed in to Infinite Campus. - red badge, both buttons disabled
- ✗ No Infinite Campus tab open. - red badge (only if no IC tab is open; Network Refresh button disabled)
- ⚠ Session status unknown - yellow badge with the specific error code shown
Warns about school hours - if the current time is a weekday between 8:00 AM and 4:00 PM, a yellow banner warns that the school may have disabled the gradebook during school hours, which can cause both methods to return empty or incomplete data.
Presents two buttons with plain-language descriptions of each strategy.
How Network Refresh Works
Network Refresh uses a 3-step API fetch sequence per course, matching exactly what the IC portal itself calls:
Step 1: Discover term IDs
GET ${base}/resources/section/{sectionID}
?_expand=terms&_expand=periods-periodSchedule&_expand=room&_expand=teachers
Returns section metadata including all term objects (one per quarter). Terms are sorted by termSeq to determine the current active quarter (the latest term whose startDate is on or before today).
Step 2: Find the grading task
GET ${base}/resources/section/teacherSections/curriculumGradingTask?_sectionID={sectionID}
Returns the list of grading tasks for the section. The task with portal: true and a task name containing "Quarter Grade" (typically taskID: 4) is used as the selectedTaskID in the next request.
Step 3: Fetch grade data
GET ${base}/resources/portal/grades/detail/{sectionID}
?classroomSectionID={sectionID}&selectedTermID={currentTermID}&selectedTaskID={taskID}
Returns a full JSON payload with terms[] and details[]. Each details entry contains the grading task result for one quarter, including all categories and assignments. Selecting the active (current) term causes IC to return data for all quarters up to and including the current one in a single response.
Session validation
GET ${base}/resources/my/userAccount
Returns the user's firstName, lastName, and personID. Used in the pre-flight dialog to confirm the session is active and to personalize the greeting.
Technical Architecture
All IC API calls are routed through the extension's background service worker:
dashboard.html (refresh-controller.js)
└─► chrome.runtime.sendMessage({ type: 'ICI_IC_FETCH', url })
└─► background.js: ICI_IC_FETCH handler
└─► fetch(url, { credentials: 'include', headers: { 'X-Requested-With': 'XMLHttpRequest' } })
└─► IC server responds with JSON
└─► returns { ok: <parsed JSON> } or { err: <reason string> }
This works because Chrome extension service workers with host_permissions can make cross-origin fetch() calls to matching URLs with full cookie access. The extension includes host permissions for both https://*.infinitecampus.org/* and https://infinitecampus.org/*, and the background service worker validates that every requested URL belongs to one of those Infinite Campus hostnames before fetching.
The API base URL is derived from the course's cached source URL using ICApiClient.buildApiBase(sourceUrl), which extracts the IC servlet context path (e.g. https://district.infinitecampus.org/campus) directly from the stored URL.
Data Parsing
The JSON response from Step 3 is parsed by ICApiClient.parseApiResponse(), which maps it to the same assignment shape used by the DOM scraper:
| IC API field | Mapped to |
|---|---|
assignmentName |
name |
score (numeric string) |
earned (number, or null if ungraded) |
totalPoints |
possible |
multiplier |
multiplier |
dropped: true |
dropped: true |
scoringType: 'm' |
letterGrade: true |
score === null |
ungraded: true, earned: null |
Ungraded assignments are identified by score === null in the API response. The extension sets earned: null for these, which causes the UI to display a dash (–) and excludes them from all grade calculations. This correctly handles the case where IC returns scorePoints: "0" but score: null for assignments that have not yet been graded.
Category weights come from the groupWeight field in the details response. The groupID in each assignment matches the categoryID from the categories endpoint, used to associate assignments with their parent categories.
Fallback Behavior
Network Refresh does not fall back to Classic scraping. If the IC API call fails for a course (for any reason other than a session error), the error propagates to the retry mechanism which retries the network call (up to 3 attempts with increasing delays). If all retries fail, the course is marked as failed with a clear error message.
If the session check fails (the user is not signed in), the Network Refresh button is disabled entirely.
Progress Dialog
During refresh, a progress dialog shows:
- A progress bar indicating how many courses have been processed.
- Per-course result rows showing: course name, the method used (
networkorscrape), and whether it succeeded or failed. - A Cancel button that stops the process after the current course finishes. A Close button appears immediately when canceled.
Troubleshooting Network Refresh
| Symptom | Likely cause | Fix |
|---|---|---|
| Network Refresh button is grey / disabled | Not signed in to IC | Sign in to Infinite Campus in the same browser window |
| "Session status unknown" badge | Session check request failed | Open an IC tab and ensure you are signed in |
| All courses fail on network | IC API returning 404 for section data | IC may be offline (school hours) or URL format has changed |
| School-hours warning shown | Weekday 8 AM - 4 PM | Try again outside school hours |
| One course fails on network | That course's API data returned an error | Check the course is still active in IC |
After Refresh: What Changed Modal
When you close the progress dialog after a refresh run, IC Insight automatically shows a What Changed Modal summarising exactly how each course moved. See that doc for full details on how grade deltas, category breakdowns, and new-assignment detection work.