Insights

Test SERP API country and language parameters in three requests

Change the country with language held constant, then change only the language. Use three requests and a worksheet to separate an absent result from a failed or unreadable response.

When testing SERP API country and language parameters, capture the fields your client actually sent. An English-looking result does not tell you whether the client sent Canada as the country. Keep the query q fixed, change either gl or hl and record the input, request status and observation in the same row.

Acceptance procedure for the three requests

Define the target and result scope first

For the example, set q to national parks and choose an exact hostname in advance, such as parks.example. That reserved hostname illustrates the entry format. Substitute the hostname you intend to observe. Agree to inspect identifiable organic links and compare their parsed hostnames exactly. Keep ads, snippet mentions and lookalike domains out of that count.

Check the contract for the interface you are using. Identify how it signals success, where the relevant result collection lives and what one response covers. Mark any undocumented result scope as unconfirmed. Record the number of identifiable items actually returned. The product example establishes q, gl and hl as inputs. Its device illustration adds no input to this test.

Send three requests with one change at each step

Run

Example JSON body for the same endpoint

Comparison

A US/EN

{"q":"national parks","gl":"us","hl":"en"}

Baseline. Capture the fields, spelling and response status.

B CA/EN

{"q":"national parks","gl":"ca","hl":"en"}

A → B changes only country from us to ca. Language stays en.

C CA/FR

{"q":"national parks","gl":"ca","hl":"fr"}

B → C changes only language from en to fr. Country stays ca.

Run the three observations close together using the same endpoint and client settings. Keep q identical, including when switching to French. Give every attempt its own ID and timestamp. If you retry B, keep B1 and add B2 instead of overwriting the first outcome. That preserves the difference between a parameter change, a retry and a later observation.

Log localized search results at three separate stages

Run, time sent and zone

Actual q / gl / hl sent

Request outcome and JSON parse

Scope, count and target

A ____

____

____

____

B ____

____

____

____

C ____

____

____

____

Record the HTTP status and API-level success or error, then whether the body parses as JSON, and finally the agreed result collection. A simulated row could read “B, 10:02 UTC, national parks / ca / en, HTTP 200, API success, valid JSON, eight returned organic links inspected, target absent.” That supports a statement about those eight links. It does not establish a position throughout the results or for an individual searcher.

For a timeout, log a failed request and mark target presence undetermined. Keep a malformed JSON body, an API-reported error or an unexpected result structure as distinct failures even if HTTP returned 200. Leave target presence undetermined in those cases. If a successful, well-formed response explicitly contains an empty collection of the agreed type, record zero items and no target in that response.

Frequently asked questions

How do I test gl and hl separately?

Compare A with B using en for both countries. Then compare B with C using ca for both languages. Keep q identical. Verify the sent parameters before comparing the same scope of results.

If all three responses look alike, were the parameters ignored?

Identical links are possible. Check the fields sent, endpoint, response status and scope. If the service provides a verifiable request record, use it to confirm processing. Identical links alone are inconclusive.

Check the request format for q, gl and hl