Difference between revisions of "Getting Started"

From Advice Local Wiki
Jump to: navigation, search
(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...")
 
(Products)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== API Endpoint ==
 
== API Endpoint ==
 
http://p.lssdev.com
 
http://p.lssdev.com
 +
 +
The Advice Local API is organized around REST and JSON is returned by all API responses.
  
 
== Authentication ==
 
== Authentication ==
In order to interact with the Advice Local API, you must include your API token for each request.
+
In order to interact with the Advice Local API, you must include your API key for each request.
  
==== Sample Request ====
+
=== Example Request ===
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
function get_client($client_id) {
+
GET /legacyclients/3201926 HTTP/1.1
$url = 'http://p.lssdev.com/legacyclients/'.$client_id;
+
Host: p.lssdev.com
 
+
x-api-token: YOUR_API_KEY
$ch = curl_init($url);
+
Content-Type: application/json
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));
 
}
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
YOUR_API_KEY - your secret API key.
  
 
== Errors ==
 
== 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".
 
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".
 
+
=== Example Response ===
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
 
array(3) {
 
array(3) {
Line 40: Line 29:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
== Clients ==
 +
[[Clients]]
 +
== Orders ==
 +
[[Orders]]
 +
== Reports ==
 +
[[Reports]]
 +
== Products ==
 +
[[Products]]
 +
 +
== Scores ==
 +
[[Scores]]

Latest revision as of 13:40, 1 December 2020

API Endpoint

http://p.lssdev.com

The Advice Local API is organized around REST and JSON is returned by all API responses.

Authentication

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

Example Request

GET /legacyclients/3201926 HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json

YOUR_API_KEY - your secret API key.

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

Example Response

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

Clients

Clients

Orders

Orders

Reports

Reports

Products

Products

Scores

Scores