Skip to content

Instantly share code, notes, and snippets.

@begriffs
Last active April 9, 2016 01:15
Show Gist options
  • Select an option

  • Save begriffs/a83f04c450f6668a9e05787479bc9199 to your computer and use it in GitHub Desktop.

Select an option

Save begriffs/a83f04c450f6668a9e05787479bc9199 to your computer and use it in GitHub Desktop.
Nomad Pass API thus far

Responsibilities of the API

  • Saving, searching
  • Geospatial queries (e.g. which nomads have checked in within x kilometers of point x)
  • Full-text search, including bios
  • Enforcing data access permissions

Things the API will not do

  • Send emails
  • Store images or other assets
  • Obtain information from social networks

Basic routes, HTTP verbs, and response fields

The API is currently running at http://api-80-145420987.us-west-1.elb.amazonaws.com

Right now anyone can see or change all data, but we will add security. Also not all routes are implemented yet, this is what we have thus far.

/checkins, /latest_checkins (GET, POST, PATCH, DELETE)
  id
  nomad_id
  when
  lat
  lon
/nomads (GET, POST, PATCH, DELETE)
  id
  first_name
  last_name
  origin_country
  passcode
/nomads_tags (GET, POST, PATCH, DELETE)
  nomad_id
  tag
/tags
  tag

/rpc/where_is (POST)
  city_name
  country_name
  country_code
  ip_from
  ip_to
  latitude
  longitude

Example queries

Get nomads named Joe and all their checkins

GET /nomads?first_name=eq.Joe&select=*,checkins{*}

Determine location of an IP address

POST /rpc/where_is
request body: { "ip": "104.156.228.98" }

Add a new tag

POST /tags
request body: { "tag": "Coder" }

List all nomads tagged with coder

GET /tags?tag=eq.coder&select=nomads{*}

What are the valid values for nomad data?

OPTIONS /nomads

List all endpoints

GET /

More info

This API is powered by PostgREST, and has an interface documented at http://postgrest.com

The API is generated entirely from a database schema: https://github.com/nomadpass-community/community-schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment