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/$%7Bart_info.art.src%7D?q=api&page=999&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 11659 results for "api"(2575ms)

getCNNNewsmain.tsx1 match

@fab1an•Updated 1 year ago
3export async function getCNNNews() {
4 const response = await fetch(
5 "https://saurav.tech/NewsAPI/everything/cnn.json"
6 );
7 const data = await response.json();

holidaysUSmain.tsx1 match

@dosirak•Updated 1 year ago
3// Public holidays in the US in 2023
4export let holidaysUS = fetchJSON(
5 "https://date.nager.at/api/v3/PublicHolidays/2023/KR"
6);

myApimain.tsx1 match

@tamlyn•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@mojombo•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

getTelAvivMobilitySpotsmain.tsx2 matches

@rustyb•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3interface APIResponse {
4 type: string;
5 crs: unknown;
9 // const url =
10 // "https://gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/860/query?where=1=1&outFields=*&f=geojson";
11 const url = "https://app.digital4grids.com/api";
12 const json_data = await fetchJSON(url);
13 return { "json_data": [] };

githubUsermain.tsx1 match

@vtdocs•Updated 1 year ago
4 const username = "stevekrouse";
5 const user = await fetchJSON(
6 `https://api.github.com/users/${username}`,
7 );
8 console.log(user);

buddhaRandomQuotemain.tsx1 match

@noaoh•Updated 1 year ago
2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;

annoymain.tsx4 matches

@ajax•Updated 1 year ago
5export async function annoy() {
6 const resume = resume2;
7 // const boo = await import("https://esm.sh/@atproto/api");
8 const { default: BskyAgent } = await import("npm:@atproto/api");
9 console.log(BskyAgent);
10 const agent = new BskyAgent.BskyAgent({ service: "https://bsky.social" });
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {
55 "Content-Type": "application/json",
56 "Authorization": "Bearer " + process.env.OPENAI_API_KEY, // Replace with your OpenAI API Key
57 },
58 body: JSON.stringify({

aliasmain.tsx1 match

@neverstew•Updated 1 year ago
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `https://api.val.town/v1/alias/${username}`;
6 if ("valName" in params)
7 url = url + `/${params.valName}`;

valToStringmain.tsx1 match

@pomdtr•Updated 1 year ago
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);

new-val-api-21 file match

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

gptApiTemplate2 file matches

@charmaine•Updated 2 days ago
mux
Your friendly, neighborhood video API.
api