x
1
2
3
4
5
6
7
8
9
10
11
12
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<div class="grid w-[48rem] max-w-full gap-8"> <div class="grid content-start gap-2"> <p class="text-xs font-semibold text-ink-muted">curl</p> <div class="min-w-0"> <div class="min-w-0 overflow-hidden rounded-card bg-code text-white shadow-float" data-controller="clipboard"> <div class="flex items-center justify-between gap-3 border-b border-white/10 px-4 py-2.5 text-[13px]"> <span class="truncate text-white/60">Google Search <span class="text-white/40">· curl</span></span> <button type="button" class="rounded-md px-2 py-1 font-semibold text-white/80 hover:bg-white/10 hover:text-white" data-action="clipboard#copy" data-clipboard-target="button">Copy</button> </div> <pre class="overflow-auto px-4 py-3 font-mono text-[12.5px] leading-[1.3125rem] text-white/90" tabindex="0" aria-label="Google Search as curl">curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google' \ --data-urlencode 'q=best brazilian footballer' \ --data-urlencode 'gl=us'</pre> <template data-clipboard-target="source">curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google' \ --data-urlencode 'q=best brazilian footballer' \ --data-urlencode 'gl=us'</template> </div> </div> </div> <div class="grid content-start gap-2"> <p class="text-xs font-semibold text-ink-muted">Python</p> <div class="min-w-0"> <div class="min-w-0 overflow-hidden rounded-card bg-code text-white shadow-float" data-controller="clipboard"> <div class="flex items-center justify-between gap-3 border-b border-white/10 px-4 py-2.5 text-[13px]"> <span class="truncate text-white/60">Google Search <span class="text-white/40">· Python</span></span> <button type="button" class="rounded-md px-2 py-1 font-semibold text-white/80 hover:bg-white/10 hover:text-white" data-action="clipboard#copy" data-clipboard-target="button">Copy</button> </div> <pre class="overflow-auto px-4 py-3 font-mono text-[12.5px] leading-[1.3125rem] text-white/90" tabindex="0" aria-label="Google Search as Python">import osimport requestsresponse = requests.get( "https://www.searchapi.io/api/v1/search", headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"}, params={ "engine": "google", "q": "best brazilian footballer", "gl": "us", },)print(response.json())</pre> <template data-clipboard-target="source">import os import requests response = requests.get( "https://www.searchapi.io/api/v1/search", headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"}, params={ "engine": "google", "q": "best brazilian footballer", "gl": "us", }, ) print(response.json()) </template> </div> </div> </div> <div class="grid content-start gap-2"> <p class="text-xs font-semibold text-ink-muted">JavaScript</p> <div class="min-w-0"> <div class="min-w-0 overflow-hidden rounded-card bg-code text-white shadow-float" data-controller="clipboard"> <div class="flex items-center justify-between gap-3 border-b border-white/10 px-4 py-2.5 text-[13px]"> <span class="truncate text-white/60">Google Search <span class="text-white/40">· JavaScript</span></span> <button type="button" class="rounded-md px-2 py-1 font-semibold text-white/80 hover:bg-white/10 hover:text-white" data-action="clipboard#copy" data-clipboard-target="button">Copy</button> </div> <pre class="overflow-auto px-4 py-3 font-mono text-[12.5px] leading-[1.3125rem] text-white/90" tabindex="0" aria-label="Google Search as JavaScript">const params = new URLSearchParams({ "engine": "google", "q": "best brazilian footballer", "gl": "us",});const response = await fetch(`https://www.searchapi.io/api/v1/search?${params}`, { headers: { Authorization: `Bearer ${process.env.SEARCHAPI_API_KEY}` },});console.log(await response.json());</pre> <template data-clipboard-target="source">const params = new URLSearchParams({ "engine": "google", "q": "best brazilian footballer", "gl": "us", }); const response = await fetch(`https://www.searchapi.io/api/v1/search?${params}`, { headers: { Authorization: `Bearer ${process.env.SEARCHAPI_API_KEY}` }, }); console.log(await response.json()); </template> </div> </div> </div> <div class="grid content-start gap-2"> <p class="text-xs font-semibold text-ink-muted">Ruby</p> <div class="min-w-0"> <div class="min-w-0 overflow-hidden rounded-card bg-code text-white shadow-float" data-controller="clipboard"> <div class="flex items-center justify-between gap-3 border-b border-white/10 px-4 py-2.5 text-[13px]"> <span class="truncate text-white/60">Google Search <span class="text-white/40">· Ruby</span></span> <button type="button" class="rounded-md px-2 py-1 font-semibold text-white/80 hover:bg-white/10 hover:text-white" data-action="clipboard#copy" data-clipboard-target="button">Copy</button> </div> <pre class="overflow-auto px-4 py-3 font-mono text-[12.5px] leading-[1.3125rem] text-white/90" tabindex="0" aria-label="Google Search as Ruby">require "json"require "net/http"uri = URI("https://www.searchapi.io/api/v1/search")uri.query = URI.encode_www_form( "engine" => "google", "q" => "best brazilian footballer", "gl" => "us")request = Net::HTTP::Get.new(uri, "Authorization" => "Bearer #{ENV.fetch("SEARCHAPI_API_KEY")}")response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }puts JSON.parse(response.body)</pre> <template data-clipboard-target="source">require "json" require "net/http" uri = URI("https://www.searchapi.io/api/v1/search") uri.query = URI.encode_www_form( "engine" => "google", "q" => "best brazilian footballer", "gl" => "us" ) request = Net::HTTP::Get.new(uri, "Authorization" => "Bearer #{ENV.fetch("SEARCHAPI_API_KEY")}") response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) } puts JSON.parse(response.body) </template> </div> </div> </div> <div class="grid content-start gap-2"> <p class="text-xs font-semibold text-ink-muted">With a token placeholder</p> <div class="min-w-0"> <div class="min-w-0 overflow-hidden rounded-card bg-code text-white shadow-float" data-controller="clipboard"> <div class="flex items-center justify-between gap-3 border-b border-white/10 px-4 py-2.5 text-[13px]"> <span class="truncate text-white/60">Fetch AI Overview <span class="text-white/40">· curl</span></span> <button type="button" class="rounded-md px-2 py-1 font-semibold text-white/80 hover:bg-white/10 hover:text-white" data-action="clipboard#copy" data-clipboard-target="button">Copy</button> </div> <pre class="overflow-auto px-4 py-3 font-mono text-[12.5px] leading-[1.3125rem] text-white/90" tabindex="0" aria-label="Fetch AI Overview as curl">curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google_ai_overview' \ --data-urlencode 'page_token=PASTE_FROM_PREVIOUS_RESPONSE'</pre> <template data-clipboard-target="source">curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google_ai_overview' \ --data-urlencode 'page_token=PASTE_FROM_PREVIOUS_RESPONSE'</template> </div> <p class="mt-2 text-[13px] text-ink-muted">Replace <code class="rounded bg-wash px-1 font-mono text-xs text-ink">PASTE_FROM_PREVIOUS_RESPONSE</code> with <code class="rounded bg-wash px-1 font-mono text-xs text-ink">ai_overview.page_token</code> from the response before it. It is valid for a few minutes.</p> </div> </div></div>1
2
3
4
5
6
7
8
<% search = CodeSnippet.new({ "query" => { "engine" => "google", "q" => "best brazilian footballer", "gl" => "us" } }) %><% follow = CodeSnippet.new({ "query" => { "engine" => "google_ai_overview", "page_token" => "[masked page_token: 119 chars]" } }) %><div class="grid w-[48rem] max-w-full gap-8"> <% CodeSnippet::LANGUAGES.each_key do |language| %> <div class="grid content-start gap-2"><p class="text-xs font-semibold text-ink-muted"><%= CodeSnippet::LANGUAGES[language] %></p><%= render RequestCodeComponent.new(snippet: search, language: language, label: "Google Search") %></div> <% end %> <div class="grid content-start gap-2"><p class="text-xs font-semibold text-ink-muted">With a token placeholder</p><%= render RequestCodeComponent.new(snippet: follow, language: "curl", label: "Fetch AI Overview", token_from: "ai_overview.page_token") %></div></div>No notes provided.
No params configured.