SDKs

Every ParseAPI lookup in your language.

Quickstart

1. Install

Terminal
npm install @parseapi/sdk

2. Add your key

Create a secret key in Keys. Set it in the terminal that will run the example. Keep it on your server.

Terminal environment
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.

example.mjs
import { parseAPI } from '@parseapi/sdk';

const parse = parseAPI(); // Reads PARSEAPI_KEY.
const country = await parse.country('US');
console.log(country.name);
Run
node example.mjs

Handle 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.

example.mjs
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.

Facts

  • One method per endpoint, named after the route. parse.country('US') is GET /country/US.
  • Same JSON as the API. Empty is null, never a guess.
  • Key from the constructor or the PARSEAPI_KEY environment 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, and request_id. A miss is not_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

Explore all tutorials →

Your language. One key.

Install the SDK. Make your first call.

Start includes 1M API requests a month for $20/mo.