Getting Started

eHive’s programming interfaces allow you to share information with other websites, applications and devices. Create you own branded website with embedded collection search and display features. Build a mobile application with images from your collection. Share records and images with a regional or national website.

Java

The Java API client library provides a way of accessing all of the eHive API methods without having to deal with low level HTTP requests and responses. Here is a simple guide on how to get started with our Java client API library:

Prerequisites

  1. Download the Java API client library.
  2. Create a new Java class file.
  3. Add the Java API client library JAR to your classpath.
  4. Create a blank file that is accessible from wherever you are running this example.
    The file is used to store your API authentication token, so it must be readable and writable. You can name the file anything you
    like as long as it is valid in Java.

Start Coding

  1. Instantiate an EHiveApi object. The EHiveApi object contains all of the methods available in the API.
    The API requires authentication credentials
    so you will need to configure your EHiveApi object with valid credentials. There are a number of ways to instantiate the EHiveApi object but for
    this example you will simply pass all of the parameters you need into the EHiveApi object’s constructor:

    	private static String clientId = "...462";
    	private static String clientSecret = "...98a9";
    	private static String trackingId = "...eaca";
    	private static String pathToOauthPropertiesFile = "oauth.properties";
    
    	...
    	EHiveApi eHiveApi = new EHiveApi(clientId, clientSecret, trackingId, pathToOauthPropertiesFile);
  2. Invoke the getAccount() method and assign the return value to an Account domain
    object
     as follows:

    	Account account = eHiveApi.getAccount(3406);
  3. Access the account information using the Account domain object’s getter method.
    	String publicProfileName = account.getPublicProfileName();
    	System.out.println(publicProfileName);

You can download the full code samples from our Downloads page.

PHP

The PHP API client library provides a way of accessing all of the eHive API methods without having to deal with low level HTTP requests and responses. Here is a simple guide on how to get started with our PHP client API library:

Prerequisites

  1. Download the PHP API client library.
  2. Create a new PHP script file.
  3. Add EHiveApi.php from the PHP API client library
    to your include path.
  4. Locate the oauth.tok file in the transport/oauth directory of the PHP API client library and ensure that it has both
    read and write permission enabled.

Start Coding

  1. Instantiate an EHiveApi object. The EHiveApi class contains all of the functions available to you in the API.
  2. Configure your EHiveApi object with valid authentication credentials. There are a number of ways to instantiate the EHiveApi object but for this example you will simply pass all of the parameter you need into the EHiveApi object’s constructor:
    	private static $clientId = "...5935";
    	private static $clientSecret = "...4c4b";
    	private static $trackingId = "...eaca";
    
    	...
    	$eHiveApi = new EHiveApi(GetAccountDemo::$clientId, 
    				 GetAccountDemo::$clientSecret, 
    				 GetAccountDemo::$trackingId, 
    				 GetAccountDemo::$pathToOauthPropertiesFile);
  3. Invoke the getAccount() method and assign the return value to a variable as follows:
    	$account = $eHiveApi->getAccount(3406);
  4. Access the information on the account object.
    	echo $account->publicProfileName;

You can download the full code samples from our Downloads page.

WordPress

WordPress is a free and open source tool for developing websites.  We have developed a suite of WordPress plugins to allow you to present your eHive object and account information within a custom WordPress website.