JavaScript
- Needs
- Node.js 18+ (server-side)
- Version
- 1.0.0
- SHA-256
- SHA256SUMS
EXNO for developers
Small, single-file clients for EXNO's REST API, with nothing else to install. Put one in your server-side app, set EXNO_API_KEY in its environment and call the API with safe retries, every page of a list and clear errors.
70664b3d3b2f9ed0cf8c060b8742e6c1258208abac5271790e97dd72d81889adf42fd40863a893822673ad5ca6b14733d07842d213547f199ea5fe673a876f0fimport { Exno } from "./exno.mjs";
const exno = new Exno(process.env.EXNO_API_KEY, { environment: "staging" });
console.log(await exno.me());
for await (const page of exno.pages("products", { limit: 25 })) console.log(page.data.length);
// a write: keep your own idempotency key to retry it safely
await exno.request("POST", "discounts", {
body: { code: "LAUNCH20", percent_off: 20 }, idempotencyKey: savedKey,
});import os
from exno import Exno
exno = Exno(os.environ["EXNO_API_KEY"], environment="staging")
print(exno.me())
for page in exno.pages("products", limit=25):
print(len(page["data"]))
# a write: keep your own idempotency key to retry it safely
exno.request("POST", "discounts", body={"code": "LAUNCH20", "percent_off": 20}, idempotency_key=saved_key)<?php
require __DIR__ . '/exno.php';
use Exno\Exno;
$exno = new Exno(getenv('EXNO_API_KEY'), ['environment' => 'staging']);
print_r($exno->me());
foreach ($exno->pages('products', ['limit' => 25]) as $page) {
echo count($page['data']), "\n";
}
// a write: keep your own idempotency key to retry it safely
$exno->request('POST', 'discounts', ['body' => ['code' => 'LAUNCH20', 'percent_off' => 20], 'idempotency_key' => $savedKey]);
// a webhook from a Created app or Developers › Webhooks
$event = Exno::verifyWebhook(file_get_contents('php://input'), $_SERVER['HTTP_EXNO_SIGNATURE'] ?? '', getenv('EXNO_SIGNING_SECRET'));// copy exno.go into your module, for example internal/exno/exno.go
client, err := exno.New(os.Getenv("EXNO_API_KEY"), exno.WithEnvironment("staging"))
if err != nil {
log.Fatal(err)
}
me, err := client.Me(ctx)
err = client.Pages(ctx, "products", map[string]string{"limit": "25"}, func(page map[string]any) error {
fmt.Println(len(page["data"].([]any)))
return nil
})
// a write: keep your own idempotency key to retry it safely
d, err := client.Request(ctx, http.MethodPost, "discounts", &exno.RequestOptions{
Body: map[string]any{"code": "LAUNCH20", "percent_off": 20}, IdempotencyKey: savedKey})
// a webhook from a Created app or Developers › Webhooks
body, _ := io.ReadAll(r.Body)
event, err := exno.VerifyWebhook(body, r.Header.Get("Exno-Signature"), os.Getenv("EXNO_SIGNING_SECRET"), 5*time.Minute)Webhooks without an SDK, and no-code tools: Zapier, Make, n8n and Pipedream.
Compare a download with its SHA-256 before you use it. The JavaScript and Python files are listed in their own SHA256SUMS.
| File | SHA-256 |
|---|---|
exno.php | 70664b3d3b2f9ed0cf8c060b8742e6c1258208abac5271790e97dd72d81889ad |
exno.go | f42fd40863a893822673ad5ca6b14733d07842d213547f199ea5fe673a876f0f |
PHP's base_url and Go's WithBaseURL point an SDK at a local copy of EXNO for development. They take only http://127.0.0.1:<port> or http://localhost:<port>, so a key can't be sent anywhere else by mistake.