Javascript API Client

Welcome to our Javascript Client Library for interacting with our API!

For web applications, mobile application containers, e-commerce, CMS and standard websites, our Javascript API allows you to perform API actions on the front end, without any server-side interaction required.

If you are interested in server-side Javascript implementations, check our NodeJS client API.

View source and usage instructions >

Installation

CDN Location
https://cdn.jsdelivr.net/gh/bigdatacloudapi/js-api-client/bigdatacloud_api_client.min.js

Example usage


<script src="https://cdn.jsdelivr.net/gh/bigdatacloudapi/js-api-client@latest/bigdatacloud_api_client.min.js" type="text/javascript"></script>
<script type="text/javascript">
	var apiKey='XXX'; // Your api key found at: https://www.bigdatacloud.com/account
    //vanilla implementation
    var client=new BDCApiClient(apiKey);
    /* You can set the default api language as needed */
    client.localityLanguage='es';

    client.call(
        /* api endpoint */
        'ip-geolocation-full',

        /* api query parameters */
        {
            'ip':'8.8.8.8',
            /* You can override the default api language on a per-query basis
            *  This is an optional parameter on all API calls */
            'localityLanguage':'zh'
        },
        function(jsonResult) {
            console.log('Vanilla result',jsonResult);
        },
        function(err,code) {
            console.log('Vanilla error',err,code);
        }
    );
    //jQuery implementation
    if (typeof jQuery != 'undefined') {
        (function($) {
            $.BDCApi('ip-geolocation-full',{
                data:{
                    ip:'8.8.8.8',
                    key:apiKey,
                    localityLanguage:'en'
                },
                success:function(jsonResult) {
                    console.log('jQuery result',jsonResult);
                },
                error:function(error,code) {
                    console.error('jQuery eror',error,code);
                }
            });
        })(jQuery);
    }
</script type="text/javascript">

Contact support

If you have any further queries, feel free to contact our email support on our contact us page .


Topics

Was this page helpful?