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=1456&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 17693 results for "api"(3386ms)

1// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
2
3export default async function main(req: Request): Promise<Response> {
4 const response = await fetch("https://www.metaweather.com/api/location/2459115/");
5 const weatherData = await response.json();
6
1// This val fetches weather data from an open API
2// The approach involves using the fetch API provided by Deno
3// to retrieve weather information for a specific location
4
5export default async function main(req: Request): Promise<Response> {
6 const apiUrl = "https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m&current_weather=true";
7
8 const response = await fetch(apiUrl);
9 const weatherData = await response.json();
10
2 // Helper functions for Blob storage
3 async function getBlob(key: string): Promise<any> {
4 const response = await fetch(`https://api.val.town/v/std/blob-${key}`);
5 if (!response.ok) throw new Error("Error fetching blob data");
6 return response.json();
8
9 async function setBlob(key: string, data: any): Promise<void> {
10 const response = await fetch(`https://api.val.town/v/std/blob-${key}`, {
11 method: "POST",
12 headers: { "Content-Type": "application/json" },

valPreviewmain.tsx3 matches

@iamseeley•Updated 10 months ago
1export async function fetchVal(valId: string) {
2 try {
3 const response = await fetch(`https://api.val.town/v1/vals/${valId}`);
4 if (!response.ok) {
5 console.error(`Error fetching val with ID ${valId}:`, response.statusText);
15export async function evalCode(code: string) {
16 try {
17 const response = await fetch(`https://api.val.town/v1/eval`, {
18 method: 'POST',
19 headers: {
26 const errorText = await response.text();
27 console.error(`Error evaluating code:`, errorText);
28 return { error: `API Error: ${response.status} ${response.statusText}`, rawResponse: errorText };
29 }
30

examain.tsx1 match

@yawnxyz•Updated 10 months ago
2import Exa from "npm:exa-js"
3
4const exa = new Exa(Deno.env.get("EXA_API_KEY"));
5
6export const exaSearch = async ({ query, type, useAutoprompt, numResults, text, summary=true, highlights }) => {

btcmain.tsx3 matches

@park•Updated 10 months ago
12 try {
13 const [priceResponse, historyResponse] = await Promise.all([
14 fetch(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=${CONFIG.COIN_GECKO_CURRENCY}`),
15 fetch(
16 `https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=${CONFIG.COIN_GECKO_CURRENCY}&days=${CONFIG.COIN_GECKO_DAYS}&interval=daily`,
17 ),
18 ]);
19
20 if (!priceResponse.ok || !historyResponse.ok) throw new Error("API request failed");
21
22 const priceData = await priceResponse.json();

similarSitesmain.tsx2 matches

@qiangua•Updated 10 months ago
2import Exa from "npm:exa-js";
3import { ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";
4const exa = new Exa(Deno.env.get("EXA_API_KEY"));
5const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
6
7export default async function handler(req: Request): Promise<Response> {

similarSitesREADME.md1 match

@qiangua•Updated 10 months ago
3Powered by [Exa](https://exa.ai/) and [Substrate](https://substrate.run).
4
5🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.

blob_adminREADME.md1 match

@nilesh•Updated 10 months ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO

audioManagermain.tsx2 matches

@yawnxyz•Updated 10 months ago
43
44export class AudioManager {
45 constructor(apiKey=null, uploadFunction = null, downloadFunction = null) {
46 this.openai = new OpenAI(apiKey);
47 this.uploadFunction = uploadFunction || this.blobUpload;
48 }

RandomQuoteAPI

@Freelzy•Updated 1 day ago

HAPI7 file matches

@dIgitalfulus•Updated 1 day ago
snartapi
apiry