DEAR Inventory API is part of DEAR Inventory web application at https://inventory.dearsystems.com. You will need to create an account there before you can use the API. Trial accounts are also allowed to access the API.


To use the API you will need your DEAR Account ID and API Application key. These can be created on the API setup page inside DEAR Inventory application:

https://inventory.dearsystems.com/ExternalAPI. Each company that you have access to in DEAR Inventory will have a different DEAR Account ID. You can have multiple API Applications created on the same DEAR account. This allows you to link different applications/add-ons to DEAR, since API limits are applied on per API Application basis.


Your Account ID and API Application Key are equivalent to a login and password. They must be kept secret and not shared in any way.


Each request to the API must include these two values sent as HTTP headers:


    api-auth-accountid - You must send your Account ID in this header.

    api-auth-applicationkey - You must send API Application Key in this header.


PHP sample:

  

$account_id = 'youraccountid';
$application_key = 'applicationkey';
 
 
$naked_dear_url = 'https://inventory.dearsystems.com/ExternalApi/SaleList';
 
 
$data = array ('Page' => '1', 'Limit' => '100');
$data = http_build_query($data);
 
 
$context_options = array (
        'http' => array (
            'method' => 'GET',
            'header'=> "Content-type: application/json\r\n"
                . "Content-Length: " . strlen($data) . "\r\n"
                . "api-auth-accountid: " . $account_id . "\r\n"
                . "api-auth-applicationkey: " . $application_key . "\r\n",
            'content' => $data
            )
        );

  

C# sample:

    

using (var httpClient = new HttpClient{ BaseAddress = "https://inventory.dearsystems.com/ExternalApi" })
{
  httpClient.DefaultRequestHeaders.Add("api-auth-accountid", "your_key");  	  
httpClient.DefaultRequestHeaders.Add("api-auth-applicationkey", "your_key");

  using(var response = await httpClient.GetAsync("SaleList"))
  {
    string responseData = await response.Content.ReadAsStringAsync();
  }
}