This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

New to API's, query works in SWQL Studio but not SWIS Query

I'm extremely new to using API's, and trying to do some basic-ish pulls using Postman for testing.  The following query works perfectly in SWQL:

SELECT TOP 100 N.NodeID, N.NodeCaption, N.NodeGroup, N.AgentIP, N.MachineType, N.LastBoot, N.OSImage, N.OSVersion, N.CustomerName, C.NodeID, C.ConfigID, C.ConfigTitle, C.DownloadTime, C.AttemptedDownloadTime, C.ModifiedTime, C.ConfigType
FROM NCM.Nodes N
INNER JOIN NCM.ConfigArchive C
ON (N.NodeID = C.NodeID)
WHERE N.CustomerName LIKE 'ClientName'
ORDER BY C.DownloadTime

With 'ClientName' being an actual value.  If I run the same query in Postman, I get the following response:

{
    "Message""A column named 'NodeID' already belongs to this DataTable.",
    "ExceptionType""System.Data.DuplicateNameException",
    "FullException""System.Data.DuplicateNameException: A column named 'NodeID' already belongs to this DataTable.\r\n   at System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column)\r\n   at System.Data.DataColumnCollection.BaseAdd(DataColumn column)\r\n   at System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column)\r\n   at SolarWinds.InformationService.Serialization.DataTableSerializer.Serialize(IQueryExpr query, ISchema schema, IQueryResultReader reader)\r\n   at SolarWinds.InformationService.Serialization.DataTableSerializer.PrepareSerialize(IQueryExpr query, ISchema schema, IQueryResultReader reader)\r\n   at SolarWinds.InformationService.Core.InformationService.RunQuery(String query, IDictionary`2 parameters, IDataSerializer serializer)"
}
 
Am I wrong expecting this to work since it worked in SWQL?
  • I would suggest either aliasing the n.nodeid or the c.nodeid or remove one of them since they are essentially the same value.  While SWQL studio may be able to handle the duplicated info with no differentiation, it would seem the swis-plugin doesn't know how to handle it well.  Not sure if it is the fix, but it is the only thing that makes sense to me at this point for the cause of the issue.  I personally would remove the c.NodeID call in the select just to see what happens.  I have seen other scenarios where SWQL studio will allow it to complete a query, but things like alerts, reports, and the API the same query work because of some minor difference in the handling of the data.


     wrote:

    I'm extremely new to using API's, and trying to do some basic-ish pulls using Postman for testing.  The following query works perfectly in SWQL:

    SELECT TOP 100 N.NodeID, N.NodeCaption, N.NodeGroup, N.AgentIP, N.MachineType, N.LastBoot, N.OSImage, N.OSVersion, N.CustomerName, C.NodeID, C.ConfigID, C.ConfigTitle, C.DownloadTime, C.AttemptedDownloadTime, C.ModifiedTime, C.ConfigType
    FROM NCM.Nodes N
    INNER JOIN NCM.ConfigArchive C
    ON (N.NodeID = C.NodeID)
    WHERE N.CustomerName LIKE 'ClientName'
    ORDER BY C.DownloadTime

    With 'ClientName' being an actual value.  If I run the same query in Postman, I get the following response:

    {
        "Message""A column named 'NodeID' already belongs to this DataTable.",
        "ExceptionType""System.Data.DuplicateNameException",
        "FullException""System.Data.DuplicateNameException: A column named 'NodeID' already belongs to this DataTable.\r\n   at System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column)\r\n   at System.Data.DataColumnCollection.BaseAdd(DataColumn column)\r\n   at System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column)\r\n   at SolarWinds.InformationService.Serialization.DataTableSerializer.Serialize(IQueryExpr query, ISchema schema, IQueryResultReader reader)\r\n   at SolarWinds.InformationService.Serialization.DataTableSerializer.PrepareSerialize(IQueryExpr query, ISchema schema, IQueryResultReader reader)\r\n   at SolarWinds.InformationService.Core.InformationService.RunQuery(String query, IDictionary`2 parameters, IDataSerializer serializer)"
    }
     
    Am I wrong expecting this to work since it worked in SWQL?

    -j_a_catlin

    Loop1 Systems: SolarWinds Training and Professional Services