Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To learn more about request formatting, making requests, and the tools available, visit see "Making API APIv1 Requests", below.
You can also get the PHP SDK for the PHP SDK for PHP libraries and sample code.

...

  • The API only comes with the full 6Connect IPAM product. If you would like to upgrade to the full version, contact sales@6Connect.com.
  • All transactions are over HTTPS (SSL - port 443) only. Any transaction not using SSL will be rejected, and you will have potentially exposed sensitive data.
  • All API results are formatted in JSON. XML support is coming soon.
  • All requests are either HTTP GET or POST requests. We suggest using POST if the length of data in the request is over 8KB.
  • You can use any language you would like to query the API. We currently have an SDK an SDK for PHP. Looking at the sample code would probably help you implement it in any language though.

...

An API request looks like this:  
https://cloud.6connect.com[your instance]/ex/api/v1/api.php?target=ipam&action=get&type=IP&mask=24

An API response is a JSON-encoded text string, and looks like this:

...

Expand


Using API Keys: 
When using the API without pre-established authentication to ProVision, you must include both your API Key and a specially-prepared query hash parameter, like so:

https://cloud.6connect.com[your instance]/ex/api/v1/api.php?target=ipam&action=get&type=IP&mask=24&apiKey=11600-MX15LUYY78ZZTW5TMHQV8CV2XZYABCD&hash=8jxj4IApYmgb5IZ0wBY4tFv+WilXb5JuVpjrwupyXQo= 

API Keys can be generated from your ProVision instance by navigating to the Admin panel by using the gear icon in the upper right hand corner, then navigating to the API tab.  The API tab will present the API authentication information in the following format:

API Key: 38 00-TMHQV8CV2XZYC2ZS TMHQV8CV2XZYABCD  

Secret Key: 6e04e5822ce90feaa8947ded46c46878 6e04e5822ce10fecc8947dedxc46878

The secret key serves as an API password and is used in the creation of the API Authentication hash.  The formula for creating a API query hash from an API query and a Secret Key is the following:

Hash = Base64Encode( Sha256HMACHash ( QueryString, SecretKey ) )

In PHP, this would be performed with the following line of code:

$hash = base64_encode(hash_hmac('sha256', $_SERVER['QUERY_STRING'], $secretKey, TRUE));

Note
Because the hash function is computed based on the query string, you must calculate a unique hash for every API request!


Info

Example

Lets say you wanted to create a hash for the following API request:

https://cloud.6connect.com/6c_375[your instance]/api/v1/api.php?target=ipam&action=get&type=IP&mask=24

And that your API Key and Secret Key are as follows:

API Key:  3200-5DAYTJQY2TZHOFOBTMHQV8CV2XZYABCD

Secret Key:  48b278ec873bda4738923dbc467f86696e04e5822ce10fecc8947dedxc46878

The first step is to append your API Key to the URL.  The API Key indicates which user is executing the API query.

https://cloud.6connect.com/6c_375[your instance]/api/v1/api.php?target=ipam&action=get&type=IP&mask=24&apiKey=3200-5DAYTJQY2TZHOFOBTMHQV8CV2XZYABCD

The next step is to isolate the Query String from the request URL.  The Query String is everything which follows the question mark.  So,

Query String: target=ipam&action=get&type=IP&mask=24&apiKey=3200-5DAYTJQY2TZHOFOBTMHQV8CV2XZYABCD

The next step is to calculate the SHA256 hash of this string with your Secret Key.  In PHP, this would be:

$sha256 = hash_hmac('sha256', "target=ipam&action=get&type=IP&mask=24&apiKey=3200-5DAYTJQY2TZHOFOBTMHQV8CV2XZYABCD", "48b278ec873bda4738923dbc467f8669", TRUE);

As this value has been 256-bit hashed, it will contain many unprintable characters.  The solution to this is to encode it in base 64 for transport.  Again, in PHP:

$hash = base64_encode($sha256);

Calculating it out yields the completed hash:

$hash = yneSFMyxPPe+3W4IOkVp50K3VStatBcRRak+2ygDUWQ=

The calculated hash can then be appended to the full API Query URL to form a completed request:

https://cloud.6connect.com/6c_375[your instance]/api/v1/api.php?target=ipam&action=get&type=IP&mask=24&apiKey=3200-5DAYTJQY2TZHOFOBTMHQV8CV2XZYABCD&hash=yneSFMyxPPe+3W4IOkVp50K3VStatBcRRak+2ygDUWQ=


Note

A Note on False Positives

ProVision utilizes several possible authentication schemes of which key-based API authentication is only one.  Session-based, username/password authentication is used for the majority of user interaction with the ProVision front end.  Because session information is stored in browsers cookies, a browser can be authenticated to execute API commands as long as the session is active.

Unfortunately, this can lead to confusion when using a machine-based API as the user might use an authenticated browser session to test API-Key based API queries.  These queries will always succeed regardless of whether the API Query Hash was calculated correctly as the system defaults to Session-based authentication when it is available.  

To ensure that session-based authentication is not polluting your API-Key based testing, always use a separate browser which is not logged in to your ProVision instance to test API queries.


Other Languages

The 6Connect API can be used in just about any scripting or programming language.  We have PHP SDK that a PHP SDK that provides example code, and several useful functions for interacting with the API. Even if you don't want to use PHP, the samples will help you create code in other languages

...

php

from the APIv1SDK page. 


Configure the SDK Security Credentials

  • Extract the zipped tar file to a directory.
  • Open the api-config.php located in the downloaded SDK files.
  • Read through the file and place in your instance name (or path for local installs), API Key and Secret Key information as specified.
  • Make sure all files are in the same directory (the core class looks for a config file in the same directory by default).
  • Run the sample code api-examples.php!

Important!

You must setup user API access before running the sample. See the previous section "Create Your API Credentials" for more information.

Expand

Prerequisites

The API only comes with a licensed 6connect ProVision application. If you would like access to a ProVision license please contact sales@6connect.com.

Create Your API Credentials

To use the 6connect SDK for PHP, you will need a 6connect API Key and Secret Key.

To create your API Key and Secret Key:

  • Log into your 6connect instance (hosted or local)
  • Click on the Admin icon, and go into the Administration section.
  • Click on the "API" tab.
  • Select the user from the drop down you want to enable API access for, and click "Generate Keys".
  • The API Key and the Secret Key will now appear directly below that.

*Note that generating a new API will automatically revoke an older API Key.

Info
6connect recommends that each user accessing the API have their own API key configured. However, you can alternatively setup API users by functionality or roles. While the platform is flexible, you should follow your organizations security policies.

Important!

Note
Your Secret Key is a secret! Only you and 6connect should ever know this information. It is important to keep it confidential to protect the privacy of your data. Store it securely and never share this key with other users or place it on other systems. Never include the secret key in requests to 6connect, support requests to 6connect, and never e-mail it to anyone. Do not share it outside your organization. No one who legitimately represents 6connect will ever ask you for your Secret Key.

Requirements

Aside from following the prerequisites, you will need a basic understanding of object oriented programming in PHP and the right tools installed on your system to use the API.

Minimum Requirements

If you aren't sure what is running on your system, you can create a php page on your system and call phpinfo() and view this page in a browser, or run php -i on the command line.

Install the SDK

Download the file "6connect_ProVision_PHP_SDK_5_1_4.tar"  from the attachments list below:

Expand
titlePHP SDK Downloads
Attachments
uploadfalse
oldfalse
sortOrderdescending
sortBycreateddate
labels

SDK for Python

python

Download the file "6c-api-examples-python.zip" from the attachments list below:

APIv1SDK page. 


Configure the SDK Security Credentials

  • Extract the zipped tar file to a directory.
  • Open the apiclient.py located in the downloaded SDK files.
  • Read through the file and place in your instance name (or path for local installs), API Key and Secret Key information as specified.
  • Make sure all files are in the same directory (the core class looks for a config file in the same directory by default).
  • Run the sample code api-examples.php!

Important!

You must setup user API access before running the sample. See the previous section "Create Your API Credentials" for more information.

Expand

Install the SDK

Attachments
uploadfalse
oldfalse
sortOrderdescending
sortBycreateddate
labels
Expand
titlePython SDK Downloads

...