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=484&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 5057 results for "api"(399ms)

updateInspoListmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1let { valTownInspoList } = await import("https://esm.town/v/rodrigotello/valTownInspoList?v=99");
2import { isValTownTeam } from "https://esm.town/v/stevekrouse/isValTownTeam";
3import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
4
5export async function updateInspoList(newList, auth) {
6 let handle = await verifyAPIAuth(auth);
7 if (isValTownTeam(handle)) {
8 valTownInspoList = newList;

autoGPT_Test2main.tsx3 matches

@stevekrouse•Updated 1 year ago
3
4export let autoGPT_Test2 = (async () => {
5 const { Configuration, OpenAIApi } = await import("npm:openai");
6 const configuration = new Configuration({
7 apiKey: process.env.openai,
8 });
9 const openai = new OpenAIApi(configuration);
10 const completion = await openai.createChatCompletion({
11 model: "gpt-3.5-turbo",
1import { testMutateSemantics } from "https://esm.town/v/stevekrouse/testMutateSemantics";
2
3export const authenticatedCanMutateAnotherSetter = (api) =>
4 testMutateSemantics({
5 stateName: "@steveVT.myTestState",
6 api,
7 mutateExpected: true,
8 mutator: (now) => `@steveVT.mutateMyState(${now})`,

API_URLREADME.md4 matches

@std•Updated 1 year ago
1# Val Town API URL
2
3When Val Town code is run on Val Town servers we use a local URL so we can save time by skipping a roundtrip to the public internet. However, if you want to run your vals that use our API, ie std library vals, locally, you'll want to use our public API's URL, `https://api.val.town`. We recommend importing and using `std/API_URL` whenever you use our API so that you are always using the most efficient route.
4
5## Example Usage
6
7```ts
8import { API_URL } from "https://esm.town/v/std/API_URL";
9
10const response = await fetch(`${API_URL}/v1/me`, {
11 headers: {
12 Authorization: `Bearer ${Deno.env.get("valtown")}`,

fetchREADME.md4 matches

@std•Updated 1 year ago
1# Proxied fetch - [Docs ↗](https://docs.val.town/std/fetch)
2
3The Javascript [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) is directly available within a Val. However sometimes fetch calls are blocked by the receiving server for using particular IP addresses. Additionally, network blips or unreliable web services may lead to failures if not handled properly.
4
5The Val Town standard library contains an alternative version, [`std/fetch`](https://www.val.town/v/std/fetch), that wraps the JavaScript Fetch API to provide additional functionality. The fetch function from [`std/fetch`](https://www.val.town/v/std/fetch) reroutes requests using a proxy vendor so that requests obtain different IP addresses. It also automatically retries failed requests several times. Note that using [`std/fetch`](https://www.val.town/v/std/fetch) will be significantly slower than directly calling the Javascript Fetch API due to extra network hops.
6
7## Usage
8
9After importing [`std/fetch`](https://www.val.town/v/std/fetch), the fetch method is used with the same signature as the Javascript Fetch API.
10
11```ts title="Example" val
12import { fetch } from "https://esm.town/v/std/fetch";
13
14let result = await fetch("https://api64.ipify.org?format=json");
15let json = await result.json();
16console.log(json.ip);

weatherGovGridREADME.md6 matches

@stevekrouse•Updated 1 year ago
1# Lookup a weather.gov grid by lat, lon
2
3Documentation: https://www.weather.gov/documentation/services-web-api
4
5> Forecasts are created at each NWS Weather Forecast Office (WFO) on their own grid definition, at a resolution of about 2.5km x 2.5km. The API endpoint for the 12h forecast periods at a specific grid location is formatted as:
6>
7> https://api.weather.gov/gridpoints/{office}/{gridX},{gridY}/forecast
8>
9> For example: https://api.weather.gov/gridpoints/TOP/31,80/forecast
10>
11> To obtain the grid forecast for a point location, use the /points endpoint to retrieve the current grid forecast endpoint by coordinates:
12>
13> https://api.weather.gov/points/{latitude},{longitude}
14>
15> For example: https://api.weather.gov/points/39.7456,-97.0892
16>
17

siteREADME.md1 match

@stevekrouse•Updated 1 year ago
1Migrated from folder: Archive/what_is_an_api_video/site

tursoREADME.md1 match

@std•Updated 1 year ago
35## Architecture
36
37This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
38
39Migrated from folder: turso/turso

queryParamsREADME.md1 match

@stevekrouse•Updated 1 year ago
1# Handling query params
2
3You can grab query parameters out of any val that is operating using the [Web API](https://docs.val.town/api/web) using [URL#searchParams](https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams).
4
5This val demonstrates how to grab a single `name` parameter, as well as convert the entire query string into an object. It returns the all the query parameters found as a json response.

docFeedbackFormREADME.md1 match

@stevekrouse•Updated 1 year ago
30```
31
32Finally, you may be wondering why I queue up feedback in `@stevekrouse.docsFeedback`, a private JSON val, and then process it via [`@stevekrouse.formFeedbackAlert`](https://www.val.town/v/stevekrouse.formFeedbackAlert) instead of sending it along to Discord directly in this val. I [tried that originally](https://www.val.town/v/stevekrouse.docFeedbackForm?v=61) but it felt too slow to wait for the API call to Discord before returning the "Thanks for your feedback" message. This is where the `context.waitUntil` method (that Cloudflare workers and Vercel Edge Functions support) would really come in handy – those allow you to return a Response, and then continue to compute. Currently Val Town requires you to stop all compute with the returning of your Response, so the only way to compute afterwards is to queue it up for another val to take over, and that's what I'm doing here.
33
34

runValAPIEx2 file matches

@charmaine•Updated 12 hours ago

PassphraseAPI2 file matches

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