SDKs
Every ParseAPI lookup in your language.
Quickstart
1. Install
npm install @parseapi/sdk2. Add your key
Create a secret key in Keys. Set it in the terminal that will run the example. Keep it on your server.
export PARSEAPI_KEY='YOUR_API_KEY'3. Make a request
Look up a country and print its name. This lookup uses your plan's request allowance.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI(); // Reads PARSEAPI_KEY.
const country = await parse.country('US');
console.log(country.name);node example.mjsHandle errors by code, such as invalid_api_key or not_found. A response with valid: false is a successful lookup.
Handle API errors in your app
The same request, with a handler for API errors. Transport failures still propagate.
import { parseAPI, ParseAPIError } from '@parseapi/sdk';
const parse = parseAPI(); // Reads PARSEAPI_KEY.
try {
const country = await parse.country('US');
console.log(country.name);
} catch (error) {
if (error instanceof ParseAPIError) {
console.error(error.code, error.status, error.requestId);
}
throw error;
}Build from what you have
Start with one lookup. Pass its answer into another when your task needs more.
- Build a local weather card
Turn a postal code into a weather card with current conditions, an observation time, and a simple way to change places.
- Build a currency picker
Suggest a display currency from a country, let people change it, and apply only the choice they accept.
- Show an event in the visitor's time zone
Put a webinar on your site with the right local start time for each visitor.
Facts
- One method per endpoint, named after the route.
parse.country('US')isGET /country/US. - Same JSON as the API. Empty is null, never a guess.
- Key from the constructor or the
PARSEAPI_KEYenvironment variable. - Ordinary lookups retry temporary failures. Paid checks make one attempt by default. You can override the retry count.
- One error type with
status,code,docs, andrequest_id. A miss isnot_found. Branch on the code, never the message. - MIT licensed. Source on GitHub.
In a mobile app
Swift and Kotlin are built for app keys. The key ships in your binary and only works for requests that carry your own bundle ID or package name, which both SDKs send for you. Lookups work from the phone. /carrier, /hlr, and email verify answer 403. Call those from your server with a secret key.
Links
Your language. One key.
Install the SDK. Make your first call.
Start includes 1M API requests a month for $20/mo.