Reliable website data extraction often begins before you write a scraper: determine whether the page already receives structured JSON from a documented or publicly delivered endpoint. This guide explains how to inspect browser network activity, identify the relevant request, verify its method and parameters, map the response schema, review pagination, and decide whether an endpoint is a better foundation than parsing rendered HTML.
Overview
Modern websites frequently separate the interface from the data behind it. A page may load a small HTML shell and then request products, articles, search results, prices, comments, or account-independent metadata as JSON. If that response contains the fields you need, using the same publicly delivered data source can be simpler and more stable than selecting values from changing visual markup.
There are two common discovery paths. First, look for official documentation, such as an API reference, developer portal, or clearly described feed. A documented API is usually the easiest option because it explains supported parameters, authentication, rate limits, and response formats. Second, inspect the requests made by a normal browser session. This can reveal an endpoint used by the site’s own frontend, even when no public documentation is linked.
Finding a request does not automatically mean you have unrestricted permission to automate it. Treat an endpoint as a data source to evaluate, not an invitation to bypass controls. Check the site’s terms, robots guidance where relevant, authentication requirements, access limits, and the sensitivity of the data. Do not attempt to defeat authentication, evade rate limits, or collect personal information without a valid purpose and appropriate authorization.
A useful discovery workflow is:
- Define the exact fields and records required.
- Open the relevant page in a browser.
- Inspect network requests while the page loads or while an interaction occurs.
- Identify responses that contain the required data.
- Replay one request carefully and document its assumptions.
- Test pagination, filtering, errors, and schema consistency before building the extractor.
What to track
1. The request that carries the data
Open browser developer tools and select the Network panel. Refresh the page, then filter requests by terms such as fetch, XHR, json, api, or a meaningful word from the page. In Chromium-based browsers, selecting a request and opening the Response or Preview tab helps confirm whether it contains structured data. Firefox and other browsers expose comparable request and response views, although labels can differ between versions.
Do not assume that a URL containing /api/ is the right request. The useful response might use a less obvious path, a GraphQL endpoint, or a request whose purpose is indicated only by its payload. Trigger the relevant interaction—such as changing a filter, opening a product, or moving to the next page—and compare the new requests with the initial page load.
2. URL, method, and parameters
Record the complete request URL, including its query string, and note whether the request uses GET, POST, or another method. A GET request may place filters in query parameters, while a POST request may send them as JSON in the request body. Capture only the parameters necessary for the intended result. Some values are temporary session tokens or analytics identifiers and should not be copied into a long-lived pipeline without understanding their purpose.
For repeatable extraction, document parameters in a small table:
| Item | Example purpose | What to verify |
|---|---|---|
| Method | GET or POST | Whether the method must remain unchanged |
| Pagination | Page number, cursor, or offset | How the next batch is requested |
| Filters | Category, date, or search term | Accepted values and empty-result behavior |
| Headers | Accept or content type | Which headers are necessary for a normal request |
| Authentication | API key, session, or none | Whether access is authorized and maintainable |
3. Response shape and field meaning
Use a JSON formatter or an editor with folding to inspect the response. Find the collection that represents the records and distinguish it from metadata such as totals, sort order, or feature flags. A response might place records under items, results, data, or a nested path such as data.products.
Map each required output field to its source path. For example, an internal record identifier may be separate from a display URL, and a price may contain both a numeric value and a formatted label. Record the expected type—string, number, Boolean, array, object, or null—and decide how missing values will be handled. This schema map becomes a practical contract for validation and future maintenance.
4. Pagination and hidden limits
Inspect the response for fields such as next, nextCursor, hasMore, total, or pageInfo. Then make a controlled request for the next page and confirm that records do not repeat or disappear. Cursor-based pagination generally requires passing a value returned by the previous response; offset-based pagination usually increments a numeric parameter. Do not infer that a large page-size parameter will be accepted simply because it appears in the interface.
5. Request dependencies
Some responses work only after an initial configuration request, with a particular locale, or with a session established through ordinary navigation. In the browser’s request details, review the request headers and cookies, but separate essential requirements from incidental browser data. A stable extractor should avoid reproducing unnecessary headers and should never hard-code secrets into source code or logs.
Cadence and checkpoints
Endpoint discovery is not a one-time task. A site can redesign its frontend, change a response schema, introduce cursor pagination, or move a field to a different object. Build periodic checks into the data workflow rather than waiting for a production failure.
For a recurring pipeline, use a practical cadence:
- Before initial development: capture a representative response, document the request, and define the expected schema.
- During development: test empty results, malformed records, pagination boundaries, non-success responses, and changes in filter values.
- Monthly or quarterly: replay a small, authorized request and compare its status, response shape, key fields, and pagination metadata with the recorded baseline.
- After a visible site change: inspect network activity again, especially if the page layout, search experience, login flow, or URL structure has changed.
- After repeated failures: determine whether the issue is a temporary outage, an expired credential, a changed parameter, a blocked request, or a genuine schema change.
Store a sanitized fixture response for testing. Remove tokens, personal information, and unnecessary identifiers before committing it to a repository. A fixture lets you test parsing logic without repeatedly contacting the live site. Pair it with JSON Schema or explicit assertions for required fields, types, and acceptable null values. For broader workflow design, see A Practical Web Scraping Data Pipeline: From HTML to Clean JSON and CSV and Validate Web Scraping Data with JSON Schema.
How to interpret changes
JSON endpoints and HTML parsing solve related but different problems. Use the following comparison when choosing an extraction strategy:
| Consideration | JSON endpoint | HTML parsing |
|---|---|---|
| Data access | Reads structured response fields | Reads elements from rendered or returned markup |
| Selector maintenance | Usually less dependent on CSS layout | Can break when classes or nesting change |
| Discovery effort | Requires network inspection and request analysis | Can begin with the page source or rendered DOM |
| Interaction support | May require understanding filters, tokens, or cursors | May require browser automation for JavaScript interactions |
| Validation | Types and required fields are often easier to assert | Text cleanup and missing elements need more handling |
| Access considerations | Must respect endpoint authorization and usage limits | Must respect the same site rules and access boundaries |
A successful test should verify more than an HTTP status. Confirm that the response is actually JSON, the expected collection exists, required identifiers are populated, records match the requested filter, and pagination advances correctly. A response with status 200 can still be an error document, an empty result caused by a missing parameter, or a partial response.
When a request stops working, compare the last known-good fixture with the new response. A field rename is a schema change; an empty collection may indicate a filter or authentication problem; a redirect may indicate a session or URL issue; and a sudden increase in response time may require a slower request cadence. Avoid immediately switching to brittle selectors or attempting to bypass a control. First establish what changed and whether the source remains appropriate for your use case.
If no suitable JSON response exists, HTML parsing remains a valid fallback. For JavaScript-rendered pages, a browser automation tool such as Playwright can capture the page after the required interaction. The related guide How to Scrape JavaScript-Rendered Websites with Playwright covers that path. When HTML is necessary, keep selectors focused and resilient rather than copying deeply nested paths; see How to Build Resilient CSS and XPath Selectors.
When to revisit
Revisit endpoint discovery on a monthly or quarterly schedule for important recurring pipelines, and immediately when recurring data points change unexpectedly. Useful warning signs include a sudden drop in record counts, new null values, duplicated pages, changed field types, failed authentication, redirects, or a site redesign. Also review the workflow when the business question changes—for example, when you add a new filter, require historical coverage, or begin collecting a field that was not previously validated.
At each review, open the source page normally, inspect one representative network request, compare it with your saved documentation, and run the extractor against a sanitized fixture and a small live sample where authorized. Update the request map, schema assertions, and operational notes together. Record the date, observed changes, and decision to keep, revise, or retire the endpoint.
Finish with this checklist:
- Confirm the data source is documented or publicly delivered through an ordinary authorized interaction.
- Record the request method, URL pattern, parameters, response path, and pagination model.
- Remove secrets and personal data from logs and fixtures.
- Validate status, content type, schema, record identity, and pagination.
- Use conservative request rates and stop when access controls or authorization boundaries are encountered.
- Schedule a monthly or quarterly review and revisit sooner after visible source changes.
That routine turns endpoint discovery into maintainable data engineering rather than a one-off browser investigation. When the source changes, you have a documented baseline, a testable schema, and a clear decision process for updating the extractor responsibly.