You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=api&page=22&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 11619 results for "api"(1448ms)
1# v2/vals Example: Creating a val with a script file
23This val shows how to create a val and add a script file to it both with the SDK and with the API. You can find both examples in `main.tsx`.
45### Getting Started
61. Remix this project
72. Create your own API token [here](https://www.val.town/settings/api/new) with **Val: Read and write** permissions
83. Create an environment variable in your remixed project called `VAL_RW_TOKEN` and paste your new API token into it
94. Run `main.tsx` and you'll create 2 new vals in your account: `new-val-sdk` and `new-val-api`
21const webhookSecret = process.env.githubWebhookApproveSmallPRs;
22// the token to make github requests (needs `repo` permissions)
23const githubApiToken = process.env.githubApproveSmallPRsToken;
24let valHttpUrl = "https://val.town";
25const ref = parentReference();
65const { Octokit } = await import("npm:@octokit/core");
66const octokit = new Octokit({
67auth: githubApiToken,
68});
69const { repository, organization } = payload;
104event: "APPROVE",
105headers: {
106"X-GitHub-Api-Version": "2022-11-28",
107},
108},