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/?q=api&page=446&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 4574 results for "api"(615ms)

unserializeableLogExmain.tsx3 matches

@stevekrouse•Updated 1 year ago
2
3export let unserializeableLogEx = (async () => {
4 const { Configuration, OpenAIApi } = await import("npm:openai");
5 const configuration = new Configuration({
6 apiKey: process.env.openai,
7 });
8 const openai = new OpenAIApi(configuration);
9 console.log(openai);
10})();

untitled_blackBoamain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { exportedKeys } from "https://esm.town/v/stevekrouse/exportedKeys";
2import { valTownInspoList } from "https://esm.town/v/rodrigotello/valTownInspoList?v=99";
3import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
4
5export let untitled_blackBoa = runValAPIAuth({
6 val: "@rodrigotello.updateInspoList",
7 args: [

big_story_visualizationmain.tsx1 match

@tmcw•Updated 1 year ago
24 import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.9/+esm";
25 import {debounce} from "https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm";
26 const ranks = await (await fetch('https://api.val.town/v1/run/tmcw.big_stories_ranks')).json();
27
28 let allDates = new Set();

privateAPIAuthenticatedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export const privateAPIAuthenticated = fetchJSON(
5 "https://api.val.town/v1/run/stevekrouse.example3",
6 {
7 method: "GET",

nyChargingStationsmain.tsx1 match

@tmcw•Updated 1 year ago
6 const { micromark } = await import("npm:micromark");
7 const rows = await fetch(
8 "https://data.ny.gov/api/views/7rrd-248n/rows.csv?accessType=DOWNLOAD&sorting=true",
9 )
10 .then((r) => r.text())

evalPost1main.tsx1 match

@stevekrouse•Updated 1 year ago
2
3export let evalPost1 = fetchJSON(
4 "https://api.val.town/v1/eval",
5 {
6 method: "POST",

big_storymain.tsx1 match

@tmcw•Updated 1 year ago
6 const nytimes =
7 await (await fetch(
8 `https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${process.env.nytimes_api_key}`,
9 )).json();
10 const now = Date.now();

testVTClientmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1export const testVTClient = (async () => {
2 const { createApiClient } = await import(
3 "https://esm.sh/gh/nbbaier/valtown-zodios@main/src/spec/valtown-client.ts"
4 );
5 const apiClient = createApiClient("https://api.val.town");
6 const params = {
7 params: { username: "stevekrouse", val_name: "fetchJSON" },
8 };
9 const user = await apiClient.getValname(params);
10 return user;
11})();

testMutateSemanticsmain.tsx5 matches

@stevekrouse•Updated 1 year ago
4export async function testMutateSemantics({
5 stateName,
6 api,
7 mutateExpected,
8 expected,
11}: {
12 stateName: string;
13 api: string;
14 mutateExpected?: boolean;
15 expected?: (old, next) => boolean;
18}) {
19 const { data: last } = await fetchJSON(
20 `${api}/eval/${stateName}`
21 );
22 const now = Date.now();
23 await fetchJSON(
24 `${api}/eval/${mutator(now)}`,
25 authenticated
26 ? {
30 );
31 const { data: next } = await fetchJSON(
32 `${api}/eval/${stateName}`
33 );
34 const mutated = next === now;

californiaBusinessNotificationsREADME.md3 matches

@tmcw•Updated 1 year ago
3![California business records search that this val will use for automated notifications](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/2a60f563-6ffd-42f2-d321-89c3243f5c00/public)
4
5There's nothing I like more than a little open data and transparency! This Val shows you how to use the [California Secretary of State Business Search](https://bizfileonline.sos.ca.gov/search/business) as a faux-API and get notifications when records change. This lets you know when a business updates their records, changes their good-standing status, and so on.
6
7Here's how to use it:
135. Now, in the network tab of your developer tools, you should see a request that ends with `false`. You'll find a number in that URL. Plug that number into the val at the spot at the top.
14
15![Browser inspector tools showing the number you need to copy for this API request](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/e44b01b2-69a2-4288-1f48-977441ad6000/public)
16
17(We're almost there!)
27### Notes
28
29- [opencorporates](https://opencorporates.com/) has a _way_ better system for open data around businesses, but to get a free API key you need to be a nonprofit or a registered journalist, and I am neither. But if you are, use that!
30- Thanks to America's laws around business registration, it's commonplace for businesses to mask their control and ownership by using registration agents and a few layers of corporate structure.

PassphraseAPI2 file matches

@wolf•Updated 2 days ago

openapi2 file matches

@stevekrouse•Updated 4 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)