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=768&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 11714 results for "api"(1032ms)

perseveringAmaranthChipmunkmain.tsx1 match

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

uploadImagemain.tsx1 match

@ajsolUpdated 5 months ago
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {
28 "content-type": "application/json",

sanguineAquaReptileREADME.md1 match

@stevekrouseUpdated 5 months ago
11[![](https://stevekrouse-button.web.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It 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).
14
15# TODO

affableMagentaPlanarianmain.tsx4 matches

@willthereaderUpdated 5 months ago
397 intervalId = setInterval(async () => {
398 try {
399 const response = await fetch("/api/progress");
400 if (!response.ok) {
401 throw new Error(`HTTP error! status: ${response.status}`);
429 setBrokenLinks([]);
430 try {
431 const response = await fetch("/api/check-links", {
432 method: "POST",
433 headers: {
602 const url = new URL(request.url);
603
604 if (url.pathname === "/api/progress" && request.method === "GET") {
605 const now = new Date();
606 if (lastProgressUpdate && currentProgress) {
631 }
632
633 if (url.pathname === "/api/check-links" && request.method === "POST") {
634 let requestBody;
635 try {

iiif44tuREADME.md5 matches

@sammeltassenUpdated 5 months ago
1[IIIF Presentation API](https://iiif.io/api/presentation/3.0/) for [4TU.ResearchData](https://data.4tu.nl/).
2
3URL scheme:
16Todo:
17
18- Add more metadata from the Djehuty API response.
19
20Limitations:
21
22- This is a temporary workaround until the Presentation API is implemented as part of Djehuty
23- Only images are currently supported (not video/audio)
24- The val needs to do some API requests before producing the manifest and doesn't cache responses
25
26Credits:
27
28- Image API implementation by Roel Janssen of 4TU.ResearchData. The source code can be found [here](https://github.com/4TUResearchData/djehuty)
29- [IIIF Builder](https://github.com/IIIF-Commons/iiif-builder) by Stephen Fraser

gptmemorymain.tsx32 matches

@toowiredUpdated 5 months ago
1import * as uuid from "https://deno.land/std/uuid/mod.ts";
2import { blob } from "https://esm.town/v/std/blob";
3import { getPolicy } from "https://esm.town/v/xkonti/memoryApiPolicy";
4import { Hono } from "npm:hono@3";
5
6export const handleMemoryApiRequest = async (
7 req: Request,
8 apiName: string,
9 contactEmail: string,
10 lastPolicyUpdate: string,
11 blobKeyPrefix: string,
12 apiKeyPrefix: string,
13) => {
14 // ==== HELPERS ====
51
52 const verifyRequest = (c): { memoriesKey: string; error: any } => {
53 // Verify API key coming as a Bearer header
54 const authHeader = c.req.headers.get("Authorization");
55 if (!authHeader || !authHeader.startsWith("Basic ")) {
67 return { memoriesKey: "", error: c.text("Forbidden", 403) };
68 }
69 const expectedKey = Deno.env.get(apiKeyPrefix + key) ?? null;
70 if (token !== expectedKey) {
71 console.error("Invalid API KEY header");
72 return { memoriesKey: "", error: c.text("Forbidden", 403) };
73 }
75 };
76
77 // API
78
79 const app = new Hono();
405 // PRIVACY POLICY
406 app.get("/privacy", async (c) => {
407 const policy = getPolicy(apiName, contactEmail, lastPolicyUpdate);
408 c.header("Content-Type", "text/html");
409 return c.html(policy);
410 });
411
412 app.get("/openapi", async (c) => {
413 const specification = `
414{
415 "openapi": "3.1.0",
416 "info": {
417 "title": "Memories and Conversations API",
418 "description": "API for managing and storing long-term memories, AI conversations, and file attachments.",
419 "version": "1.2.0"
420 },
421 "servers": [
422 {
423 "url": "<APIURL>"
424 }
425 ],
434 },
435 "401": {
436 "description": "Unauthorized - Missing or invalid API key."
437 },
438 "403": {
439 "description": "Forbidden - Invalid API key."
440 }
441 },
468 },
469 "401": {
470 "description": "Unauthorized - Missing or invalid API key."
471 },
472 "403": {
473 "description": "Forbidden - Invalid API key."
474 }
475 },
524 },
525 "401": {
526 "description": "Unauthorized - Missing or invalid API key."
527 },
528 "403": {
529 "description": "Forbidden - Invalid API key."
530 }
531 },
571 },
572 "401": {
573 "description": "Unauthorized - Missing or invalid API key."
574 },
575 "403": {
576 "description": "Forbidden - Invalid API key."
577 }
578 },
602 },
603 "401": {
604 "description": "Unauthorized - Missing or invalid API key."
605 },
606 "403": {
607 "description": "Forbidden - Invalid API key."
608 },
609 "404": {
641 },
642 "401": {
643 "description": "Unauthorized - Missing or invalid API key."
644 },
645 "403": {
646 "description": "Forbidden - Invalid API key."
647 }
648 },
674 },
675 "401": {
676 "description": "Unauthorized - Missing or invalid API key."
677 },
678 "403": {
679 "description": "Forbidden - Invalid API key."
680 },
681 "404": {
728 },
729 "401": {
730 "description": "Unauthorized - Missing or invalid API key."
731 },
732 "403": {
733 "description": "Forbidden - Invalid API key."
734 },
735 "404": {
781 },
782 "401": {
783 "description": "Unauthorized - Missing or invalid API key."
784 },
785 "403": {
786 "description": "Forbidden - Invalid API key."
787 },
788 "404": {

professionalFuchsiaSmeltmain.tsx1 match

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

blob_adminREADME.md1 match

@jasonleefrenchUpdated 5 months ago
11[![](https://stevekrouse-button.web.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It 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).
14
15# TODO

DadJokesmain.tsx1 match

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

searchArXiVmain.tsx1 match

@aleafUpdated 5 months ago
1export const searchArXiV = async ({ query = "", start = 0, max_results = 10 }) => {
2 const { parseStringPromise } = await import("npm:xml2js")
3 const url = new URL("https://export.arxiv.org/api/query")
4 url.searchParams.set("search_query", query)
5 url.searchParams.set("start", String(start))

gpt-image-test

@CaptainJackUpdated 30 mins ago
测试 gpt image 的不同 api 能否满足图片生成要求

new-val-api-21 file match

@shouserUpdated 1 day ago
This is an example of using the API to create a val.
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