I have a custom API which im calling from my GQI to get data. The GQI data is then rendered in grid component LCA. I refresh the grid every 10 seconds, and I cache API response in my GQI for 30 seconds. So for every 30 secs i call my custom API to get data.
Sometimes the API client call throws 401 error even though im passing correct token. this error is thrown once for every 4 API call.
I tried to get data from same API through postman, there also i get same 401 error for once in every 4 calls.
what could be the issue here and how to resolve this?
By custom API I assume you mean a 3rd party API and not a user defined API within Dataminer. As you are getting the same error in postman the problem most likely lies at the API endpoint. I can think of two possible reasons;
- Rate limiting by the API. (Slow down the rate of requests to see if it makes a difference)
- Load balancing at the endpoint and one of the servers the requests gets to invalidates the token.
These are of course wild guesses but I think the focus of your investigation should be on the endpoint serving your requests.

In that case your first port of call should be the Data Aggregator (DxM) logs which you can access via System Center > Logging or C:\ProgramData\Skyline Communications\DataMiner DataAggregator\Logs.
Can you check and see if the logs shed more light when you get the authentication error.
Hi Baranisudha,
If you are using User-Defined APIs, this could be caused by the automatic load balancing sending a request to a DMA in your cluster that is experiencing some issues. Do you have by any chance 4 agents in the cluster?
You could check the response body of the 401 error, and you should normally see a JSON structure as explained here: https://docs.dataminer.services/user-guide/Advanced_Modules/User-Defined_APIs/UD_APIs_Triggering_an_API.html#errors
There is a 'faultingNode' field that should reflect on which DMA specifically the validation was done. Check if there are any errors in the 'C:\Skyline DataMiner\Logging\SLUserDefinableApiManager.txt' log file. Also make sure that the DMA is pointing to the same Elasticsearch/OpenSearch cluster so it has access to all tokens & definitions. You could double-check this by using Cube to connect to this faulting DMA & going to 'System Center' -> 'User-Defined APIs'. There, you should see at least the token that you are using. If that is not the case, in most cases, the manager initialization could have failed, or the DMA is not correctly pointing to the same indexing DB cluster as the other agents. Let me know what you find.
I have user defined API in dataminer.