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/$%7Bsuccess?q=api&page=1018&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 11847 results for "api"(1161ms)

githubUsermain.tsx1 match

@vtdocsUpdated 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

@noaohUpdated 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

@ajaxUpdated 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

@neverstewUpdated 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

@pomdtrUpdated 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);

chatmain.tsx2 matches

@nimaluUpdated 1 year ago
1import { chatMessages } from "https://esm.town/v/nimalu/chatMessages";
2
3// https://api.val.town/express/@nimalu.chat
4export const chat = (req, res) => {
5 const messages = chatMessages
24 document.getElementById("message-input").value = '';
25 const ul = document.getElementById("inbox");
26 const data = await fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
27 .then(res => res.json())
28 .then(res => res.data)

myApimain.tsx1 match

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

testPostCallmain.tsx1 match

@mehmetUpdated 1 year ago
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",
6 {
7 method: "POST",

exchangeCurrencymain.tsx1 match

@mgruelUpdated 1 year ago
1import { getExchangeRates } from "https://esm.town/v/mgruel/getExchangeRates";
2
3/** Calls https://www.exchangerate-api.com to retrieve the currency exchange rates
4 * for the provided base currency or "eur" if undefined
5 * @param {string} desired - The desired currency convert to

pageApimain.tsx1 match

@mgruelUpdated 1 year ago
9 };
10};
11export const pageApi = async <T extends any = any>(
12 url: string,
13 { offset = 0, limit = 25 }: {

simple-scrabble-api1 file match

@bryUpdated 14 hours ago

social_data_api_project3 file matches

@tsuchi_yaUpdated 21 hours ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration