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/image-url.jpg?q=api&page=1471&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 17672 results for "api"(5314ms)

blobAdminREADME.md1 match

@yawnxyz•Updated 11 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

hostResumemain.tsx5 matches

@iamseeley•Updated 11 months ago
1export async function hostResume(jsonResume, apiKey) {
2 const userDetailsEndpoint = 'https://api.val.town/v1/me/';
3 const createValEndpoint = 'https://api.val.town/v1/vals/';
4
5 // get user details
7 method: 'GET',
8 headers: {
9 'Authorization': `Bearer ${apiKey}`
10 }
11 });
22 method: 'POST',
23 headers: {
24 'Authorization': `Bearer ${apiKey}`,
25 'Content-Type': 'application/json'
26 },

sqliteExplorerAppREADME.md1 match

@adrianmg•Updated 11 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@adrianmg•Updated 11 months ago
26 <head>
27 <title>SQLite Explorer</title>
28 <link rel="preconnect" href="https://fonts.googleapis.com" />
29
30 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
31 <link
32 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
33 rel="stylesheet"
34 />

purpleKangaroomain.tsx1 match

@willthereader•Updated 11 months ago
3import { renderToString } from "npm:react-dom/server";
4
5// This uses by personal API key, you'll need to provide your own if
6// you fork this. We'll be adding support to the std/openai lib soon!
7const openai = new OpenAI();

valBackupmain.tsx11 matches

@iamseeley•Updated 11 months ago
1import { ValTownAPI } from 'https://esm.town/v/iamseeley/ValTownAPI';
2import { GitHubAPI } from 'https://esm.town/v/iamseeley/GitHubAPI';
3
4const VAL_TOWN_API_KEY = Deno.env.get('valtown');
5const GITHUB_TOKEN = Deno.env.get("GITHUB_TOKEN");
6const GITHUB_REPO = "iamseeley/vals-backup";
7const GITHUB_BRANCH = "main";
8
9const valTownAPI = new ValTownAPI(VAL_TOWN_API_KEY);
10const gitHubAPI = new GitHubAPI(GITHUB_TOKEN);
11
12async function fetchVals() {
13 const response = await valTownAPI.getAllVals();
14 return response.data;
15}
18 console.log(`Fetching existing files from repo: ${GITHUB_REPO}, branch: ${GITHUB_BRANCH}`);
19 try {
20 const response = await gitHubAPI.getRepoContent(GITHUB_REPO, "", GITHUB_BRANCH);
21 console.log("Existing files:", response);
22 return response.map(file => file.path);
32
33 for (const file of files) {
34 const commitHistory = await gitHubAPI.getCommitHistory(GITHUB_REPO, file, GITHUB_BRANCH);
35 lastModifiedDates[file] = new Date(commitHistory[0].commit.committer.date).getTime();
36 }
46 if (fileExists) {
47 console.log(`File exists: ${filePath}`);
48 const shaResponse = await gitHubAPI.getRepoContent(GITHUB_REPO, filePath, GITHUB_BRANCH);
49 const sha = shaResponse.sha;
50 console.log(`Fetched SHA for ${filePath}: ${sha}`);
52 throw new Error(`Failed to fetch SHA for ${filePath}`);
53 }
54 await gitHubAPI.updateFile(GITHUB_REPO, filePath, fileContent, sha, commitMessage, GITHUB_BRANCH);
55 console.log(`File updated: ${filePath}`);
56 } else {
57 console.log(`File does not exist: ${filePath}`);
58 await gitHubAPI.createFile(GITHUB_REPO, filePath, fileContent, commitMessage, GITHUB_BRANCH);
59 console.log(`File created: ${filePath}`);
60 }

GitHubAPImain.tsx6 matches

@iamseeley•Updated 11 months ago
1export class GitHubAPI {
2 constructor(private token: string) {}
3
4 async getRepoContent(repo: string, path: string, branch: string) {
5 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`, {
6 method: 'GET',
7 headers: {
18
19 async getFileSHA(repo: string, path: string, branch: string) {
20 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`, {
21 method: 'GET',
22 headers: {
34
35 async updateFile(repo: string, path: string, content: string, sha: string, message: string, branch: string) {
36 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}`, {
37 method: 'PUT',
38 headers: {
59
60 async createFile(repo: string, path: string, content: string, message: string, branch: string) {
61 const url = `https://api.github.com/repos/${repo}/contents/${path}`;
62
63 let body: any = {
104
105 async getCommitHistory(repo: string, path: string, branch: string) {
106 const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=${path}&sha=${branch}`, {
107 method: 'GET',
108 headers: {

ValTownAPImain.tsx6 matches

@iamseeley•Updated 11 months ago
1export class ValTownAPI {
2 constructor(private apiKey: string) {}
3
4 async getUserID() {
5 const response = await fetch('https://api.val.town/v1/me', {
6 method: 'GET',
7 headers: {
8 'Authorization': `Bearer ${this.apiKey}`,
9 'Content-Type': 'application/json'
10 }
21 async getAllVals() {
22 const userId = await this.getUserID();
23 const response = await fetch(`https://api.val.town/v1/users/${userId}/vals`, {
24 method: 'GET',
25 headers: {
26 'Authorization': `Bearer ${this.apiKey}`,
27 'Content-Type': 'application/json'
28 }

GitHubAPIREADME.md1 match

@iamseeley•Updated 11 months ago
1Migrated from folder: val_backup/GitHubAPI

ValTownAPIREADME.md1 match

@iamseeley•Updated 11 months ago
1Migrated from folder: val_backup/ValTownAPI

RandomQuoteAPI

@Freelzy•Updated 1 day ago

HAPI7 file matches

@dIgitalfulus•Updated 1 day ago
apiry
Kapil01