Getting Started

From Advice Local Wiki
Revision as of 11:49, 12 December 2017 by Psu (talk | contribs) (Created page with "== API Endpoint == http://p.lssdev.com == Authentication == In order to interact with the Advice Local API, you must include your API token for each request. ==== Sample Req...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

API Endpoint

http://p.lssdev.com

Authentication

In order to interact with the Advice Local API, you must include your API token for each request.

Sample Request

function get_client($client_id) {
	$url = 'http://p.lssdev.com/legacyclients/'.$client_id;

	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
		'x-api-token: pk_746d0c5e505c047c228e58fc8b93009',
		'Content-Type: application/json'
		)
	);
	curl_setopt($ch, CURLOPT_TIMEOUT, 5);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);

	$result = curl_exec($ch);
	curl_close($ch);
	
	var_dump(json_decode($result, true));
}

Errors

Any time the API engine throws an exception, the REST web service will catch the exception and return false with a message relaying what the error was and success = "false".

array(3) {
  ["success"]=>
  bool(false)
  ["data"]=>
  NULL
  ["error"]=>
  string(57) "Sorry, there was an error while trying to run your query."
}