Two ways to integrate#
SkedCast's API is a REST API described by an OpenAPI 3.1 document, so you can use it from any language in one of two ways:
- Call the REST API directly with
fetch,curlor your language's HTTP client, using the request and response shapes in the quickstart and the conventions reference. - Generate a typed client from the OpenAPI document at https://skedcast.com/openapi.json with a tool such as openapi-typescript and openapi-fetch (TypeScript), openapi-generator or Kiota (most other languages).
Generate TypeScript types#
bash
npx openapi-typescript https://skedcast.com/openapi.json -o skedcast.d.tsCreate a post with the generated types#
ts
import createClient from "openapi-fetch";
import type { paths } from "./skedcast";
const client = createClient<paths>({
baseUrl: "https://api.skedcast.com/v1",
headers: { Authorization: `Bearer ${process.env.SKEDCAST_API_KEY}` },
});
const { error, response } = await client.POST("/posts", {
params: { header: { "Idempotency-Key": crypto.randomUUID() } },
body: {
clientId: "00000000-0000-4000-8000-000000000001",
content: "Our autumn collection is live.",
targets: { mode: "accounts", accountIds: ["00000000-0000-4000-8000-000000000002"] },
schedule: { type: "at", scheduledAt: "2030-01-15T15:00:00Z" },
},
});
if (error !== undefined) {
// A 429 carries Retry-After in seconds: wait that long, then retry with the same Idempotency-Key.
throw new Error(`SkedCast answered ${String(response.status)}`);
}Generate a client in another language#
bash
# openapi-generator
npx @openapitools/openapi-generator-cli generate \
-i https://skedcast.com/openapi.json -g python -o ./skedcast-client
# Kiota
kiota generate --openapi https://skedcast.com/openapi.json \
--language python --class-name SkedCastClient --output ./skedcast-clientclient librariesopenapitypescript
FAQ
- Is there an SDK package I can install?
- SkedCast does not publish an SDK package. The REST API is plain HTTP with an OpenAPI 3.1 document, so you either call it directly or generate a typed client for your language from https://skedcast.com/openapi.json.
- What languages can I use?
- Any language that can make an HTTP request. Generators such as openapi-generator and Kiota produce a typed client for most languages from the OpenAPI document.
- How should a client handle errors and rate limits?
- Errors use the RFC 9457 problem+json format with a stable code. A 429 carries Retry-After in seconds. Retry a 429, 502, 503 or 504, or a request that got no response, with the same Idempotency-Key: SkedCast runs it once or returns the first result. Every other answer, including a 500, is kept for 24 hours and returned again for that key, so send a new key to try again.