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=1570&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 18012 results for "api"(1629ms)

vtWishListREADME.md1 match

@nbbaier•Updated 1 year ago
3Some things I'd love to see come to val town (some of these are already on the way according to the team)
4
5- [x] Editing a val's readme through the API
6- [x] A command bar (something like [paco's cmdk](https://cmdk.paco.me/) would be *dope*)
7- [ ] The ability or programmatically respond to events (like a val being run) right within Val Town

vtIdeaListREADME.md3 matches

@nbbaier•Updated 1 year ago
5- [ ] A bare bones CMS to edit markdown files hosted on a github (or val town readmes eventually)
6- [ ] A set of Vals for interacting with github repos via Octokit (useful for the above CMS idea)
7- [ ] A full json-server like implementation for quickly generating stub APIs based on json/valtown blob data ([begun](https://www.val.town/v/nbbaier/dbToAPI))
8- [ ] An implementation of [Convert bookmarklet to Chrome extension](https://sandbox.self.li/bookmarklet-to-extension/)
9- [ ] A tool for generating an NPM package from a Val or set of Vals (something like [dnt]- [ ] (https://github.com/denoland/dnt/))
11- [ ] A component library (this would be a wild swing for me)
12- [ ] A val to get a dependency graph of a val(s) ([started here](https://www.val.town/v/rlesser/dependency_graph) by [rlesser](https://www.val.town/u/rlesser))
13- [ ] A single val that wraps a [FeTS client](https://the-guild.dev/openapi/fets) to the API for saving a couple of lines of boilerplate
14- [ ] A val for generating OpenAPI specs from jsdoc comments within vals (sort of like [this npm package](https://www.npmjs.com/package/jsdoc-openapi))
15- [ ] Conways game of life
16

basicAuthREADME.md1 match

@pomdtr•Updated 1 year ago
17```
18
19If you want to use an apiToken as a password:
20
21```ts

api_updates_demomain.tsx4 matches

@andreterron•Updated 1 year ago
3const randomId = () => Math.random().toString(36).substring(2, 8);
4
5const createResult = await fetchJSON(`https://api.val.town/v1/vals`, {
6 method: "POST",
7 bearer: Deno.env.get("valtown"),
8 body: JSON.stringify({
9 code: `console.log(42);`,
10 name: `api_test_${randomId()}`,
11 }),
12});
14console.log("Created with name:", createResult.name);
15
16const newName = `api_test_updated_${randomId()}`;
17
18const updateResult = await fetch(`https://api.val.town/v1/vals/${createResult.id}`, {
19 method: "PUT",
20 headers: {

api_updates_demoREADME.md1 match

@andreterron•Updated 1 year ago
1Migrated from folder: A_Features/_23_12_04_Update_Vals_API/api_updates_demo

nftMetadatamain.tsx2 matches

@jamiedubs•Updated 1 year ago
3
4export async function fetchNftMetadata(contractAddress: string, tokenId: string) {
5 const apiKey = process.env.ALCHEMY_API_KEY;
6 const rpcUrl = `https://eth-mainnet.g.alchemy.com/nft/v2/${apiKey}`;
7 const url = `${rpcUrl}/getNFTMetadata?contractAddress=${contractAddress}&tokenId=${tokenId}`;
8 const response = await fetch(url, {

untitled_bronzeCoralmain.tsx1 match

@zhengcor•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

untitled_amethystShrewmain.tsx1 match

@adheep04•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

untitled_sapphireEchidnamain.tsx1 match

@seamusmuf123•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

crates_iomain.tsx3 matches

@vladimyr•Updated 1 year ago
12import { joinURL } from "npm:ufo@1.3.2";
13
14const API_URL = "https://crates.io/api/v1/";
15
16const VersionSchema = transform(
17 object({
18 num: string(),
19 dl_path: string([toCustom(input => (new URL(input, API_URL)).href)]),
20 yanked: boolean(),
21 }),
27
28export async function getCrateInfo(crateName: string, version?: string) {
29 const createURL = joinURL(API_URL, `/crates/${crateName}`);
30 const crateInfo = parse(CrateInfoSchema, await ky.get(createURL).json());
31 const versions = crateInfo.versions.filter(it => !it.yanked);

Apiify7 file matches

@wolf•Updated 28 mins ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1