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.

Impossible to create Orion objects through API (PowerShell SWIS or REST API)

Hello,

I need to create and manage Orion objects (example API Poller) through API (Powershell Swis or REST API). My problem is the lack of documentation provided by Solarwinds. Could you please help me on this topic or tell me if this topic is not possible due to a product limitation ?

Thank you in advance for your help and have a nice day

Regards

Parents Reply
  • As you navigate through the entities such as Orion.APIPoller.RequestDetails in SWQL studio you will notice that some support CREATE operations. Here is an example that will CREATE a new Orion.APIPoller.RequestDetails

    #Setup Orion.APIPoller.RequestDetails
    
       $OrionAPIPollerRequestDetails = @{
        url ="APIPoller";
        ApiPollerId=242;
        HttpVerb="Get";
        CredentialsType="NoAuth";
        VerifySslCertificate="True";
        UseProxy="False";
        RequestDetailsOrder="0";
        RequestTimeout="0";
    }
    
    $NewOrionAPIPollerRequestDetails = New-SwisObject $swis -EntityType "Orion.APIPoller.RequestDetails" -Properties $OrionAPIPollerRequestDetails
    

    There is more to it than this as some values will be created automatically and will need to match when creating other related entities, as I do not have a full workflow to share right now I wanted to share this example with you as a starting point to demonstrate how the API can be used to do more than pull data.

Children
  • Hi  Thank you for the example, it helped me a lot.

    I am in the same Nicolas situation. Did you happen to know the tables that we should insert the data following this workflow? Which tables are going to be updated automatically?

    I am not sure if Orion.APIPoller.ApiPoller table should have anything to do with the workflow. So, the main goal is to know which tables have to be updated with the new information on the API Pollers.

    For now I have inserted new data into Orion.APIPoller.RequestDetails and Orion.APIPoller.PollingConfiguration where the ApiPollerId value matches in both tables.

    What about Orion.APIPoller.ApiPoller table? Does it get updated the first time a Polling is done?

    Thank you!

  • Hello Tony,

    Thank you for the useful info. I have tested successfully your example in my environment in the specific table.

    Unfortunately, this table is not the only one to configure properly an API Poller. When I try to set also the table APIPoller.ApiPoller with the following code I receive an error message:

    $OrionAPIPoller = @{
        Description = "apipoller_desc";
        DetailsUrl = "/Orion/View.aspx?NetObject=OAPI:17";
        DisplayName = "apipoller_dn";
        Name = "apipoller_name";
        RelatedEntityId = 877;
        RelatedEntityType = "Orion.Nodes";
    
    }
    $NewOrionAPIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoller" -Properties $OrionAPIPoller
    

    The error message:

    New-SwisObject : Property Description of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:34 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject

    The error is similar when I try to do the same using the SWQL studio. And again no documentation found on that topic : no table schema, no creation rule or requirement, no examples.

    Thank you in advance for your patience and your help.

    Have a nice day

    Regards

  • Seems like you can't set any value to the column Description. Try removing that property from your JSON.

    UPDATE: I have tested and seems like that table will be automatically updated by Solarwinds when a polling is triggered

  • Hello Mulambo,

    I have tried unsuccessfully to remove info from the JSON for the different variables but I receive the same kind of error message:

    New-SwisObject : Property Description of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:34 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    
    ---
    
    New-SwisObject : Property DetailsUrl of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:33 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    
    ---
    
    New-SwisObject : Property DisplayName of entity type Orion.APIPoller.ApiPoller is a computed property and cannot be set during Create.
    At line:32 char:22
    + ... APIPoller = New-SwisObject $swis -EntityType "Orion.APIPoller.ApiPoll ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-SwisObject], FaultException`1
        + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject
    

    I don't understand also your update : which table you are talking about ? Did you create something using the webUI or did you use exclusively powershell ? Thank you

  • I tried to create a record on the table Orion.APIPoller.ApiPoller  by using PowerShell and it can't be done. Seems like that table can't be modified by a 3rd party app via APIs through CRUD operations. 

  • Exactly... but SWQL indicates the opposite:

    If the documentation is resumed by the red square in the screenshot it is a shame for a paid product like Orion... I'm very disappointed. And a bit angry because the Solarwinds support do not help me except tolding me to grab info in this forum

  • Possibly, or incorrect documentation. I have opened a case to look into it in more detail

  • Hi

    I found that there is another table that can't be object of CRUD operations although the documentation says any CRUD is allowed.

    When I try to create a record on the Orion.APIPoller.ValueToMonitor table I receive this error in PowerShell:


           $ValueToMonitor = @{
           ApiPollerId = $Queryresult+1;
           StatusDescription = "Up";
           Metric = $Metric;
           Status = 1;
           DetailsUrl = $pivote;
           StringToNumberTransformationOtherValues = 0;
           Type = $Path;
           ThresholdRule = $ThresholdRule;
           CriticalThreshold = $CriticalThreshold;
           WarningThreshold = $WarningThreshold;
           Path = $Path;
           DisplayName = $DisplayName;
           RequestIdDetails = $Queryresult;
           }
    
    $NewOrionAPIPollerInfo = New-SwisObject $swis -EntityType "Orion.APIPoller.ValueToMonitor" -Properties $ValueToMonitor
    
    
    New-SwisObject : Property DetailsUrl of entity type Orion.APIPoller.ValueToMonitor is a computed property and cannot be set during
    Create.
    At C:\Users\chacongj\Documents\Test scripts\PowerShell\Test_API_Poller.ps1:158 char:30
    + ... ollerInfo = New-SwisObject $swis -EntityType "Orion.APIPoller.ValueTo ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [New-SwisObject], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.NewSwisObject

    Questions:

    (1) Did you receive any feedback about these issues?

    (2) Do you know what exactly should be the flow to create polling data within these tables via CRUD operations?

  • Hello Tony,

    Do you have received any feedback from your open incident ?

    For info I have also contacted the support team for that issue.

    Have a nice day

    Regards