Capturing network requests (Fetch/XHR)
Sometimes it is more convenient to extract the required data from one or more of the Fetch/XHR requests that a browser makes while loading the web page, rather than parsing the HTML.
Web Scraper API supports returning the list of XHR requests made while loading the web page.
Usage
To get a list of XHR requests in the response, you can submit a payload similar to the one below:
The response will contain a list of JSON objects, each of which representing a single XHR request.
Output key
Description
Type
url
Full URL of the XHR request
string
status_code
HTTP status code of the response
integer
method
HTTP method used for the request
string
request_headers
Key-value pairs of request headers, including cookies
object
response_headers
Key-value pairs of response headers, including cookies
object
request_payload
Payload (only include this key with POST, PUT, PATCH requests)
string
response_body
Response body
object
Last updated
Was this helpful?