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?
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.