CATCH LOC Developers

Login

Installation and Get started

Add Library (CatchLoc-SDK.min.js/CatchLoc-SDK.min.mjs Download)


            Save the downloaded CatchLoc-SDK.min.js file in the desired path and add it to the html document.
            <script src="path/to/CatchLoc-SDK.min.js"></script>
            

            To implement in module format, please download CatchLoc-SDK.min.mjs file.
            You can import the class by import into the JavaScript file you want to implement.

            import {CatchLoc} from 'path/to/CatchLoc-SDK.min.mjs';
            

Creating Instance and initialization


            Inject API key and server key to SDK to initialize SDK instance.

            CatchLoc.setApiKey('API KEY');
            CatchLoc.setServerKey('SERVER KEY');

            If you have imported the module,
            let catchloc = new CatchLoc() After creating an object like this, you can call a function on the object variable.


            After initialization, you can run SDK functions that call APIs.
            

Handle Result (Example)


            Since it is executed asynchronously (ajax), the result is processed using a callback function.

            After initializing the SDK, enter two parameters when calling the function.

            CatchLoc.getLastData(params, callback);


            - params (json object)
            let params =
            {
                Set API Request Body in json format
            };

            - callback
            function callback(json)
            {
                1. Check the result value 'ok' in response
                2. Check the type in response (array or json)
                3. Processes the result value according to the type value

                - When type is array
                let items = json.message;

                for (var i in items)
                {
                    let item = items[i];

                    Handle item...
                }

                - When type is json, You can refer to API Response and process without necessarily looping.
            }