Funadvice.net API Documentation


ADD KUDOS
---------
Complement a user on a job well done.

Endpoint:
/v1/kudo

Method:
POST

Parameters:
* api_key (Required)
* username (requred - to give kudos to)
* content (a note attached to the kudo)

Returns
{:status => 'ok/failed', :kudo => {newly created kudo}}

MAKE A REQUEST
--------------
Request help from one or several advisors

Endpoint:
/v1/request

Method:
POST

Parameters:
* api_key (Required)
* src - what kind of request. eg: "phone" (required)
* src_id - eg: phone number (optional)
* utm_source (optional)
* utm_campaign (optional)
* content (required) - the actual request
* username - to be sent to a single user

Returns:
{:status => 'ok/fail', :request => {the newly created request}}

SEARCH FOR SKILLS
-----------------
Return a list of skills matching a query

Endpoint:
/v1/skills

Method:
GET

Parameters:
* q (search query, can be partial word)

Returns
[ {skill}, {skill}, ... ]

GET MY CONTACTS
---------------
Get my contacts organized by skill

Endpoint:
/v1/contacts

Method:
GET

Paramters:
* api_key
* limit (default 100)

Returns:
{skill => [user, user, ...], ... }

DELETE A CONTACT
-----------------
Delete an existing contact

Endpoint:
/v1/delete_contact

Method:
POST

Parameters:
* api_key
* username - of person to remove as contact

Returns:
{:status => 'ok|not found'}

ADD A CONTACT
-------------
Add a new contact

Endpoint:
/v1/contact

Method:
POST

Parameters:
* api_key
* username - of person to add as a contact

Returns:
{:status => 'ok|not found'}

GET SOME POSTS
--------------
Get some posts based on various criteria

Endpoint
/v1/posts

Method:
GET

Parameters:
* api_key - posts by a user and posts about skills related to a user (optional)
* username - posts by a user (optional)
* skill - for a certain skill (permalink, optional)
  If none of username or skill, just returns most recent stuff
* limit (Default 100)

Returns
[ {post}, {post},... ]

GET A POST
----------
Get a post and all it's children and authors

Endpoint:
/vi/post

Method:
GET

Parameters:
* id
* api_key (optional)

Returns
[ {post}, {post}, ... ]

CREATE A NEW POST
-----------------
Creates a new post

Endpoint:
/v1/post

Method:
POST

Parameters:
* api_key
* content
* parent_id (integer, optional)
* skill (string, optional)
* skill_id (integer, optional - used instead of skill)
* username (page to write on - optional)

ME
--
Load my profile

Endpoint:
/v1/me

Method:
GET

Parameters:
* api_key

Returns
{ user record }

EMAIL AUTHENTICATION
--------------------
Join or login with Email

Endpoint:
/v1/signup/email

Method:
POST

Parameters:
* email
* password
* name (optional)

Returns:
{ user_profile }
or
{:status => 'Incorrect password'}

FACEBOOK AUTHENTICATION
-----------------------
Join or login with Facebook

Endpoint:
/v1/signup/facebook

Method:
POST

Parameters:
* access_token (the facebook access token)

Return:
{ user record }


API STATUS
----------
Returns basic status about the API

Endpoint:
/status

Method:
GET

Parameters:
None

Returns:
{
  :status => 'down or up',
  :users => number_of_users,
  :skills => number_of_skills,
  :timestamp => now,
  :params => echo_any_parameters
}


LAYER AUTHENTICATION
--------------------
Authenticates a new user to the Layer.com System

Endpoint:
/v1/layer/auth

Method:
POST

Parameters
* api_key
* nonce (as received from Layer.com)

Returns:
A token from Layer to move forward


PHONE AUTHENTICATION
---------------------
Used to signup a new user, or sign in.

Endpoint:
/v1/signup/phone

Method:
POST

Parameters:
* phone - any valid phone number

Returns:
{:status => 'ok', :phone => '+19999999999'}
Store the phone number received. You will need it during confirmation.

200 OK - will send a text message to the users device containing the verification code.
500 - invalid phone number or some other problem

CONFIRMATION
------------
Used to confirm the number that was just used to signup or sign in.

Endpoint:
/v1/confirm/phone

Method:
POST

Parameters:
* token - token entered by user from text message 
* phone - phone number you stored from /signup/phone

Returns:
{ user's profile }
This API key contained there, will be used to make all subsequent requests.

200 - A user account was created, or the user was confirmed
404 - The token and phone pair was not found.

UPDATE PROFILE
--------------
Update your profile.

Endpoint:
/v1/update

Method:
POST

Parameters:
* api_key
* name
* username
* location
* lang (2 character language code, eg: "en")
* about
* url
* kind - ("p"=person, "b"=business)
* attachment (a photo attachment)
* show_phone - 1 (show), or 0 (do not show) 

Returns:
{ updated user record }
200 We are good
500 Some other error

Whenever you get this back, you should save this locally

USER PROFILE
------------
Load a user's profile

Endpoint:
/v1/user

Method:
GET

Parameters:
* api_key
* username

Return
{ the user's profile }


UPDATE/ADD SKILLS
-----------------
Update the user's skills.

Endpoint:
/v1/update/skills

Method:
POST

Parameters:
* api_key
* skills[] - An array of skills (text)
eg: ['plumbing', 'ruby on rails, 'ios developer']

Return
{ the user's profile }


UPDATE THE DEVICE
-----------------
Update the user's device

Endpoint:
/v1/update/device

Method:
POST

Parameters:
* api_key
* device_name - eg: "Ericson Smith's iPhone"
* device_type - eg: 'iphone/ipad/ipod'
* device_id - push notifiction id
* push_enabled true/false

Return
{ :status => 'ok' }

Call this method after successfully asking for push notification permissions.


PEOPLE NEAR ME
--------------
Returns lists of people near me

Endpoint:
/v1/people

Method:
GET

Parameters:
* api_key
* q (optional - searches skills)
* limit (default 200)
* lat (optional)
* lng (optional)
* users[] (optional - a list of ids to return)

Return list of users
[{profile}, {profile}, ...]