Is there an API in Forge to fetch JSM customers filtered by customer details (with sorting & pagination)

Summary

The question revolves around the availability of an API in Forge for Jira Service Management (JSM) that can fetch customers filtered by customer details with support for sorting and pagination. The goal is to retrieve space customers based on profile fields, custom attributes, status, etc., and sort them accordingly.

Root Cause

The root cause of the issue is the lack of a straightforward API in Forge that supports filtering JSM customers by detailed criteria (beyond email or accountId) and also offers sorting and pagination capabilities. The existing API, such as ‘/jsm/csm/api/v1/customer/details/bulk’, does not fully meet these requirements as it lacks filtering and sorting support based on customer details.

Why This Happens in Real Systems

This happens in real systems due to several reasons:

  • Limited API Capabilities: Many APIs are designed with basic functionality in mind and may not cover all possible use cases or filtering requirements.
  • Data Complexity: Customer data can be complex, involving various attributes and custom fields, making it challenging to design an API that can efficiently filter and sort based on these details.
  • Security and Privacy: Implementing detailed filtering might raise security and privacy concerns, as it could potentially expose sensitive customer information.

Real-World Impact

The real-world impact of not having such an API includes:

  • Inefficient Data Retrieval: Developers might have to fetch all customer data and then filter it on the client side, which can be inefficient and slow.
  • Limited App Functionality: The lack of detailed filtering and sorting capabilities can limit the functionality and usability of apps built on the Forge platform for JSM.
  • Increased Development Time: Developers may need to spend more time implementing workarounds or custom solutions to achieve the desired filtering and sorting, increasing development time and cost.

Example or Code (if necessary and relevant)

// Example of a hypothetical API call that filters customers by details and sorts them
fetch('/jsm/csm/api/v1/customer/details', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  },
  params: {
    filter: 'profileField=value',
    sort: 'lastName ASC',
    limit: 10,
    offset: 0
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));

How Senior Engineers Fix It

Senior engineers fix this issue by:

  • Evaluating Existing APIs: Thoroughly reviewing the available APIs to ensure no existing solution is overlooked.
  • Custom Implementations: Developing custom backend services or utilizing third-party services that can handle complex filtering and sorting if the native API does not support it.
  • Optimizing Data Retrieval: Implementing efficient data retrieval strategies, such as caching, to minimize the impact of lacking API capabilities.

Why Juniors Miss It

Juniors might miss this because:

  • Lack of Experience: Inexperience with complex API requirements and limitations.
  • Overlooking Documentation: Failing to thoroughly read through API documentation or missing crucial details about available endpoints and parameters.
  • Insufficient Testing: Not adequately testing API calls with various parameters to understand the full scope of their capabilities and limitations.

Leave a Comment