6connect API - Making API Requests
API requests can be generated within the web UI by the API Request Generator, or generated programatically in any language.
API request looks like this:
https://cloud.6connect.com/ex/api/v1/api.php?target=ipam&action=get&apiKey=38-3NMTNS71JTFX&type=IP&mask=24&time=1335316083&hash=VR/owFQCik9HkbsM/oBcfNiLzHSrw=
An API response 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"}]}
Using API keys
When using the API without an established authentication to ProVision, you must include both the 'apiKey' and 'hash' parameters.
apiKey: Found at Admin→API
hash: The hash is generated from your secret key and the query string. The exact algorithm is base64_encode(hash_hmac('sha256', preg_replace('/&hash=.*$/', '', $_SERVER['QUERY_STRING']), $secretKey, TRUE)); but the PHP-SDK is the supported method of accessing the API.
An easy way to test the API and ensure that keys for a user are setup correctly, is to use the API Request Generator, located in the web interface at Admin→API. Fill out the fields specifying the type of request, and any additional data. Click "Generate Request URL", and copy and paste the resulting URL into a web browser. The request URL and response will look like those listed above.
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.