photo-documentation/docs/api/GetHelloWorld.markdown
2013-01-28 22:49:14 -05:00

2.3 KiB

Hello World


  1. Purpose
  2. Endpoint
  3. Parameters
  4. Examples
  1. Response

Purpose of the Get Hello World API

This endpoint is used to test connectivity and/or authentication. Any parameters passed in the query string are returned in the response.


Endpoint

Authentication: optional

GET /hello.json

Parameters

  1. auth (optional), Pass this in with a value of true to test OAuth requests.

Examples

Command Line (using openphoto-php)

# without authentication
./openphoto -p -h current.openphoto.me -e /hello.json

# with authentication
./openphoto -p -h current.openphoto.me -e /hello.json -F 'auth=true'

PHP (using openphoto-php)

// without authentication
$client = new OpenPhotoOAuth($host);
$response = $client->get("/hello.json");

// with authentication
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/hello.json", array('auth' => 'true'));

Response

The response is in a standard response envelope.

  • message, A string describing the result. Don't use this for anything but reading.
  • code, 200 on success
  • result, Any GET parameters passed in to the request plus __route__.

Sample

{
  "message":"Hello, world!",
  "code":200,
  "result":
  {
    "__route__":"\/hello.json"
  }
}