API v1 (Deprecated)
It is highly recommended that any customer utilizing ProVision's API for custom scripting refer to APIv2 documentation instead, and consider upgrading existing APIv1 scripts to use APIv2.
However, APIv1 documentation will remain accessible from the links below in order to support legacy uses.
APIv1 - Overview
The 6Connect API is a RESTful API to access your data in the 6Connect tools. ReST relies on stateless, client-server communication, and is usually always implemented using the HTTP protocol (the 6Connect API uses HTTPS). It is a simple and lightweight alternative to Web Services and can implemented in nearly any language. The 6Connect API operates similarly to other popular ReST APIs you may have worked with, such as Facebook or Twitter. You simply create an HTTP GET or POST request according to our standard, send it to the server, and receive data back.
To learn more about request formatting, making requests, and the tools available, see "Making APIv1 Requests", below.
You can also get the PHP SDK for PHP libraries and sample code.
Here are some important details about our ReST implementation:
- 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 for PHP. Looking at the sample code would probably help you implement it in any language though.
Making APIv1 Requests
API requests can be generated within the web UI by the API Request Generator, or generated programmatically in any language.
An API request looks like this: https://[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:
{"success":1, "message":"1 blocks found", "data":[{"id":"7539","oct1":"1","oct2":"2","oct3":"3","oct4":"0","mask":"24","child1":null,"child2":null,"is_assigned":"0","is_swipped":"0", "is_aggregate":"1","custid":"holding","last_updated_time":"2012-03-20 09:49:00","description":null,"parent":null,"rir":"ARIN","notes":"2012-03-20 09:49:00","generic_code":null,"region":null,"vlan":null,"arin_net_id":null,"arin_cust_id":null,"arin_swip_time":"0000-00-00 00:00:00","assigned_time":"2012-03-20 09:45:12"}]}
Instructions on decoding this return data can be found in the API endpoint documentation pages.
Click here to 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://[your instance]/ex/api/v1/api.php?target=ipam&action=get&type=IP&mask=24&apiKey=00-TMHQV8CV2XZYABCD&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: 00-TMHQV8CV2XZYABCD
Secret Key: 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));
Other Languages
The 6Connect API can be used in just about any scripting or programming language. We have 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
APIv1 - Getting Started with the SDK
The 6connect API allows you to access to data and functions of the 6connect web tools. The SDK for PHP or Python will help you get this setup quickly by outlining the requirements, prerequisites and provide sample code.
SDK for PHP
Click here to 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.
Important!
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 APIv1 SDK 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.
SDK for Python
Click here to expand...
Install the SDK
Download the file "6c-api-examples-python.zip" from the APIv1 SDK 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.
APIv1 Documentation (Deprecated)