CATCH LOC Developers

Login

[Group Management] API access for adding group memeber

Description

API access to add location object's group member.

API

api_code : api.common.group.set.object.add

HOST : http://cms.catchloc.com/api.partner.common.php

Method : GET

Protocol : JSON

Parameters

api : api_code
api_key : Client's partner key
timestamp : Unix timestamp
cert_key : certification key
group_key : HASH KEY to certify GROUP
member_key : HASH KEY to certify device

Response

result: RESULT
message:result code

Example

Rest API
Android SDK
Swift(iOS) SDK
PHP SDK
Javascript SDK

            ===== Request =====

            http://cms.catchloc.com/api.partner.common.php?
            api=api.common.group.set.object.add&
            api_key=xxxxx&
            timestamp=1513319595&
            cert_key=xxxxx&
            group_key=xxxxxx&
            member_key=xxxxxx



            ===== Response =====

            - Success
            {
              "result":"OK",
              "message":"GROUP_MEMBER_ADD"
            }

            - Fail
            {
                "result":"FAIL",
                "message":"Reason"

                Reason:
                - DUPLICATED_GROUP_MEMBER : device already registered to specified group
                - NO_MEMBER_INFO : No device information allocated to member_key
                - NO_GROUP_INFO : No group information allocated to group_key
            }
        

            ===== Request =====

            String group_key = "HASH KEY to certify GROUP";
            String member_key = "HASH KEY to certify device";

            CatchLoc catchloc = new CatchLoc();

            catchloc.setApiKey("API KEY");
            catchloc.setServerKey("SERVER KEY");

            JSONObject result = catchloc.addGroupMember(group_key, member_key);



            ===== Response (JSONObject) =====

            {
                "result"  : "ok",
                "type"    : "jsonobject",
                "message" : API Response Body
            }

        

            ===== Request =====

            import CatchLocSDKForAPI (common)

            CatchLocAPI.shared.setApiKey(API_KEY)
            CatchLocAPI.shared.setserverKey(SERVER_KEY)

            -GROUP_KEY : HASH KEY for GROUP authentication
            -MEMBER_KEY : HASH KEY for DEVICE authentication

            CatchLocAPI.shared.addGroupMember(groupKey: GROUP_KEY, memberKey: MEMBER_KEY)
            { result in
                
                let jsonData = result.response

                or

                let jsonString = result.description()
                
            }

            ===== Response =====

            {
                "response" : API Response Body
            }
        

            ===== Request =====

            $group_key = 'HASH KEY to certify GROUP';
            $member_key = 'HASH KEY to certify device';

            $catchloc = new CatchLoc();

            $catchloc->setApiKey("API KEY");
            $catchloc->setServerKey("SERVER KEY")

            $result = $catchloc->addGroupMember($group_key, $member_key);


            ===== Response (JSON String) =====

            "{
                "result"  : "ok",
                "type"    : "map",
                "message" : API Response Body
            }"
        

            ===== Request =====

            var callback = function(json)
            {
                code... (handle for api response)
                (e.g. : create marker on map or print list)
            };

            var params =
            {
                group_key: 'HASH KEY to certify GROUP',
                member_key: 'HASH KEY to certify device',
            };

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

            CatchLoc.addGroupMember(params, callback);



            ===== Response (JSON, using parameter in callback function) =====

            {
                "result"  : "ok",
                "type"    : "json",
                "message" : API Response Body
            }