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=1269&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 14057 results for "api"(3671ms)

getOpenapiEmbeddingmain.tsx5 matches

@wilt•Updated 1 year ago
2
3/**
4 * Call OpenAPI Embeddings api to vectorize a query string
5 * Returns an array of 1536 numbers
6 */
7export const getOpenapiEmbedding = async ({ openapiToken, query }: {
8 openapiToken: string;
9 query: string;
10}): Promise<number[]> =>
11 fetchJSON("https://api.openai.com/v1/embeddings", {
12 method: "POST",
13 headers: {
14 Authorization: `Bearer ${openapiToken}`,
15 "Content-Type": "application/json",
16 },

apiTestmain.tsx1 match

@wilt•Updated 1 year ago
1export const apiTest = async (arg: Request) => {
2 return Response.json({
3 ok: true,

nearbyJonBomain.tsx1 match

@jonbo•Updated 1 year ago
46 console.log("hi");
47
48 fetch("https://api.val.town/v1/run/jonbo.fetchBcycleCounts")
49 .then((response) => {
50 if (!response.ok) {

basicAPIExmain.tsx4 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// accessible via API at https://api.val.town/eval/@stevekrouse.basicAPIEx
4export const basicAPIEx = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);
7// Bonus: the whole runtime is available in the URL Bar 🤯
8// ie https://api.val.town/eval/"The first holiday is "+ @stevekrouse.basicAPIEx[0].name

valBeeExamplemain.tsx1 match

@stevekrouse•Updated 1 year ago
4export const valBeeExample = async () => {
5 return (valbeeTest = fetchText(
6 "http://numbersapi.com/random/math"
7 ));
8};

twitterUsermain.tsx2 matches

@stevekrouse•Updated 1 year ago
12 twitterJSON({
13 url: handle
14 ? `https://api.twitter.com/2/users/by/username/${handle}`
15 : `https://api.twitter.com/2/users/${id}`,
16 bearerToken,
17 });

myApimain.tsx1 match

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

mathFactmain.tsx1 match

@kkga•Updated 1 year ago
3// Random math fact
4export let mathFact = fetchText(
5 "http://numbersapi.com/random/math"
6);

myApimain.tsx1 match

@frankysnow•Updated 1 year ago
1export function myApi(name: Interval) {
2 console.email("hi " + name);
3}

readMediumPostsmain.tsx1 match

@patrick_kw_chiu•Updated 1 year ago
5 const articlesDatabase = initDatabase({
6 appId: process.env.MONGODB_ARTICLES_APP_ID,
7 apiKey: process.env.MONGODB_ARTICLES_API_KEY,
8 databaseName: "medium",
9 });

book-lookup5 file matches

@nucky•Updated 7 hours ago
use google book api to look up bibliographic metadata elements

new-val-api-demo

@shouser•Updated 1 day ago
This is an example of using the API to create a val.
snartapi
mux
Your friendly, neighborhood video API.