Blog

API-Driven Automation of the Cross-Panel Tracker Batch Cloning Process

Through close collaboration with our partners, we support the critical need for business expansion through sub-dealer or reseller networks. A key challenge lies in helping their customers manage operational environments with hundreds of objects. To address this, we offer different tools that tailor access to specific needs.  In addition to the comprehensive Admin Panel for customer, device, and billing management, we're developing API-driven functionalities to automate routine tasks and streamline partner workflows.

One of the frequently used exercises is cloning objects. Cloning a tracker is helpful when you want to provide multiple users access to the exact GPS tracker while maintaining separate user accounts. For example, suppose you have registered all your trackers in one user account but need your colleagues to monitor and supervise particular groups of trackers. In that case, you can create separate user accounts for them in the Admin Panel and clone the necessary trackers into their accounts. To learn more about clones, please refer to the “Tracker Clones” article.

A clone is a virtual instance of an existing GPS tracker in the Navixy platform. Clones allow you to create one or more copies of an existing tracker and place them in multiple independent user accounts. This means several users can monitor the exact GPS tracker from their accounts.

Cross-panel tracker cloning challenges 

Cloning a single tracker is generally a simple task. However, challenges emerge when trying to replicate a tracker across admin panels within the same "primary account  <->  reseller" structure. In the past, although the primary admin panel could access all the data of its resellers, replicating trackers between admin panels in the same structure wasn't possible... but that's no longer the case!

We've upgraded the cloning functionality to now allow for the duplication of trackers from one admin panel to another within the same structure, all through the use of the primary admin panel account's session. This enhancement is readily available through our API. Additionally, we're excited to introduce the concept of batch cloning, which supports the duplication of up to 1,000 trackers in a single operation. Further along in this post, we'll explore how to carry out both single and batch cloning processes.

Tracker cloning within hierarchy

This enhancement completely resolves the issue of cloning trackers within the primary account and reseller hierarchy for API users. While user interface updates are still pending, the full functionality is already accessible through the API.

This new verification technique implemented on the backend empowers the primary admin panel to oversee cloning throughout its entire hierarchy. Partners can now manage extensive cloning tasks without contacting support, reducing the workload for both parties.

Here is an example of a possible hierarchy for the Admin Panel - Reseller - User - Tracker structure:

Tracker Cloning Within Hierarchy

API access for cross-panel cloning

In practice, API users can leverage this functionality to automate the entire cloning process within their end-client onboarding workflow. Alternatively, the API allows for efficient, on-demand initiation of cloning requests whenever needed.

For illustration purposes, consider using an HTTP client like Postman to execute single or batch cloning operations. Postman provides a user-friendly interface for constructing and sending HTTP GET and POST requests. While Postman serves as a popular example, any HTTP client with cURL functionality will suffice. We'll delve into using Postman with Navixy, including the Navixy Postman collection, in a dedicated section. For more insights, please refer to the “Streamline development with Navixy API and Postman” blog post.

Let’s start with the simple cloning action using the “clone” API method:

1. If you haven't already, create a new collection in Postman by clicking on the “Create new collection” as shown below.

Create new collection

2. After creating the new collection, you can start working by adding a request. Press the “Add Request” link as indicated in the screenshot below.

Add Request

3. Let’s get a session key (the hash key) using admin panel credentials. The “auth” method provides a hash when authorised successfully.

Set the POST method and enter the API URL:

application/json

Proceed to the “Body” tab by entering the credentials as a JSON:

Proceed to the “Body”

and press the “Send” button on the right.

4. You will receive the hash key that you will need to perform the cloning action. Any panel action requires a hash key. We just go through all the steps here, so everything is clear after reading the article.

hash key

5. After you get the hash key, you can proceed with cloning. Change the URL to the following:

Substitute the example hash with the hash key you obtained earlier, add the target user ID and source tracker, and paste the result in the “Body” of the request. Please note that only non-clone objects (source trackers) can be cloned.

{"hash": "1234567890abcdf1234567890abcdf", "tracker_id": 2876352, "user_id": 277617, "label": "Courier (Clone)"}

Press the “Send” button.

Send

6. In this case, I specified the target user that comes from another Reseller from my admin panel hierarchy. The reseller is highlighted in the following screenshot:

reseller_admin panel

But the source tracker belongs to the main admin panel account:

API-Driven Automation of the Cross-Panel Tracker Batch Cloning Process

A successful cloning action results in a new object ID (tracker number), which can be reused in further scenarios.

Response:

{
    "id": 3056626,
    "success": true
}

API access for the batch cloning

We have introduced the batch cloning action. This call allows for creating clones across the main admin panel hierarchy, similar to regular single-object cloning. Here's how it can be performed.

All the steps above are mostly the same except for the URL and the “Body” data (the payload).

The new batch action is the “batch_clone” method.

Adjusting the URL and “Body”:

{"hash": "1234567890abcdf1234567890abcdf", "user_id": 277617, "tracker_ids": [2883610, 2887704, 2881467]}

Sending the request results in the following example:

request_results

The response contains clone tracker IDs that are ready to be used in the target user of the reseller above:

{
    "list": [
    	3056696,
    	3056697,
    	3056698
    ],
    "success": true
}

API-Driven Automation of the Cross-Panel Tracker Batch Cloning Process

When cloning trackers in the batch mode, original tracker labels are retained.

Conclusion: seamless and reliable cloning 

For instance, you can clone a thousand trackers in a single operation, eliminating the need for numerous cloning actions. This approach minimises API load, freeing up capacity for additional operations and ensuring that systems under heavy load continue functioning without interruption.

The batch clone action is designed to be transactional. This means the entire transaction is reversed if even one tracker encounters an error during the cloning process. This rollback feature provides a highly efficient method for managing large batches of trackers, eliminating the need to identify and separate any problematic trackers from those that were successfully cloned.

For further details on this feature, we invite you to visit our
 Developers portal.

If you still have questions or need more information, we're ready to assist you!
Click here to access our contact details and connect with our team.

← Previous articleNext article →
Ready for the most innovative GPS tracking software?
SIGN UP
Recent posts

Navixy On-Premise