Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Image%20title%22?q=api&page=953&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 13805 results for "api"(1298ms)

RepresentingAJokemain.tsx1 match

@lentinimojchers•Updated 5 months ago
5async function fetchRandomJoke() {
6 const response = await fetch(
7 "https://official-joke-api.appspot.com/random_joke",
8 );
9 return response.json();

aqiREADME.md1 match

@kbarienti•Updated 5 months ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

visionaryPeachAspmain.tsx5 matches

@stevekrouse•Updated 5 months ago
169 }
170
171 // Existing API proxy logic
172 const { API_URL } = await import("https://esm.town/v/std/API_URL?v=5");
173 const { fetchJSON } = await import("https://esm.town/v/stevekrouse/fetchJSON");
174 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
175 const Authorization = req.headers.get("Authorization") as string;
176 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization } });
177 if (!meRes.ok) {
178 return new Response("Unauthorized", { status: 401 });
232 );
233
234 const socialDataURL = new URL("https://api.socialdata.tools/twitter/search");
235 socialDataURL.searchParams.set("query", query);
236 const socialDataResults = await fetchJSON(socialDataURL.toString(), {
237 bearer: Deno.env.get("SOCIAL_DATA_API_KEY"),
238 });
239

spectacularAzureAngelfishmain.tsx4 matches

@stevekrouse•Updated 5 months ago
5Chart.register(...registerables);
6
7import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
8import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
9import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
132 // Existing social data proxy logic remains unchanged
133 const Authorization = req.headers.get("Authorization") as string;
134 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization } });
135 if (!meRes.ok) {
136 return new Response("Unauthorized", { status: 401 });
190 );
191
192 const socialDataURL = new URL("https://api.socialdata.tools/twitter/search");
193 socialDataURL.searchParams.set("query", query);
194 const socialDataResults = await fetchJSON(socialDataURL.toString(), {
195 bearer: Deno.env.get("SOCIAL_DATA_API_KEY"),
196 });
197

sqliteExplorerAppREADME.md1 match

@mparker•Updated 5 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@mparker•Updated 5 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

petunia_chatmain.tsx1 match

@robertmccallnz•Updated 5 months ago
19
20const sharedStyles = `
21@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;700&display=swap');
22
23body {

twitterAlertREADME.md3 matches

@dhruv•Updated 5 months ago
4
5This val gets Twitter data via [SocialData](https://socialdata.tools) via
6@stevekrouse/socialDataProxy. Val Town Pro users can call this API
7100 times per day, so be sure not to set this cron to run more than once every 15 min.
8If you want to use it more, get your own [SocialData](https://socialdata.tools)
9API token and pay for it directly.
10
11## 1. Query
13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 2. Notification

LotecaV2main.tsx2 matches

@maxm•Updated 5 months ago
58 async function buscarDadosLoteria(numero = null) {
59 const url = numero
60 ? `https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/${numero}`
61 : "https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/";
62
63 try {

glifbuxmain.tsx10 matches

@jamiedubs•Updated 5 months ago
8const startingBalance = 100;
9
10interface ApiResponse {
11 status: number;
12 body: any;
131}
132
133function handleHome(baseUrl: string): ApiResponse {
134 return {
135 status: 200,
139}
140
141async function handleBalance(address: string | null): Promise<ApiResponse> {
142 if (!address) {
143 return {
153}
154
155async function handleSend(data: any): Promise<ApiResponse> {
156 const { from, to, amount } = data;
157 if (!from || !to || amount === undefined) {
193}
194
195async function handleAccounts(): Promise<ApiResponse> {
196 const accounts = await getAllAccounts();
197 return {
201}
202
203async function handleMint(data: any, authHeader: string | null): Promise<ApiResponse> {
204 const { address, amount } = data;
205 if (!address || amount === undefined) {
235}
236
237function handleFavicon(): ApiResponse {
238 return {
239 status: 204,
242}
243
244function handleNotFound(): ApiResponse {
245 return {
246 status: 404,
249}
250
251function logRequestResponse(req: Request, res: ApiResponse) {
252 console.log(`Request: ${req.method} ${req.url}`);
253 console.log(`Response: Status ${res.status}, Body:`, res.body);
260 const path = url.pathname;
261
262 let response: ApiResponse;
263
264 switch (true) {

new-val-api-demo

@shouser•Updated 4 hours ago
This is an example of using the API to create a val.

groq-api2 file matches

@cameronpak•Updated 8 hours ago
mux
Your friendly, neighborhood video API.
api