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=442&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"(524ms)

updateValByIDmain.tsx1 match

@nbbaier•Updated 1 year ago
20 };
21
22 return fetchJSON(`https://api.val.town/v1/vals/${valId}`, {
23 headers: {
24 Authorization: `Bearer ${token}`,

updateValByNamemain.tsx1 match

@nbbaier•Updated 1 year ago
14 };
15
16 return fetchJSON("https://api.val.town/v1/vals", {
17 headers: {
18 Authorization: `Bearer ${token}`,

fetchPaginatedDataREADME.md2 matches

@nbbaier•Updated 1 year ago
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:
7```ts
8const id = <vt user id>
9await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
10 headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
11});

placemarkGlobeMonitormain.tsx2 matches

@tmcw•Updated 1 year ago
2
3export default async function(interval: Interval) {
4 const versions = await fetch("https://www.figma.com/api/plugins/1323092380415927575/versions").then(r => r.json());
5 const { install_count, like_count, view_count } = versions.meta.plugin;
6
10
11 {
12 const versions = await fetch("https://www.figma.com/api/plugins/1189962635826293304/versions").then(r => r.json());
13 const { install_count, like_count, view_count } = versions.meta.plugin;
14

placemarkGlobeMonitorREADME.md1 match

@tmcw•Updated 1 year ago
3I develop two Figma plugins - [one that lets you create vector street maps in Figma](https://www.figma.com/community/plugin/1189962635826293304/placemark) and [one that lets you generate vector globes](https://www.figma.com/community/plugin/1323092380415927575). It's fun to watch them get some usage, but the Figma community site is pretty barebones.
4
5This uses one of the APIs on the Community page as an unofficial API and collects results in [Val Town SQLite](https://docs.val.town/std/sqlite/). You can see a chart of the resulting data [on Observable](https://observablehq.com/@tmcw/placemark-figma-plugin-stats).

getDadJokemain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let getDadJoke = () => fetchJSON("https://official-joke-api.appspot.com/random_joke");

dbToAPIREADME.md3 matches

@nbbaier•Updated 1 year ago
1## Create an API from a [lowdb blob](https://www.val.town/v/pomdtr/lowdb)
2
3This val exports a function that takes a lowdb instance and returns a [Hono](https://hono.dev) router that can be used to interact with the data. This is the beginning of an implementation of something like [json-server](https://github.com/typicode/json-server) for Val Town.
4
5The resulting server also comes with a frontend at `/`. The code for the frontend can be found [here](https://www.val.town/v/nbbaier/dbToAPIFrontend).
6
7See [this val](https://www.val.town/v/nbbaier/dbToAPIexample) for an example.
8
9### Things I'd like to implement

oldfashionedmain.tsx2 matches

@tmcw•Updated 1 year ago
302 <script src="https://unpkg.com/htmx.org@1.9.6/dist/htmx.min.js">
303 </script>
304 <link rel="preconnect" href="https://fonts.googleapis.com" />
305 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
306 <link
307 href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,500&display=swap"
308 rel="stylesheet"
309 />

untitled_orangeImpalamain.tsx1 match

@stevekrouse•Updated 1 year ago
2
3export const untitled_orangeImpala = fetchJSON(
4 "https://api.openai.com/v1/usage?date=2023-11-01",
5 {
6 headers: {

getValREADME.md1 match

@stevekrouse•Updated 1 year ago
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: Archive/getVal

PassphraseAPI2 file matches

@wolf•Updated 1 day 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)