7 Replies Latest reply on Aug 19, 2015 11:13 AM by kevinbastiani

    REST API help

    kevinbastiani

      I have been able to create a couple functions in Powershell to do some tasks like change a custom variable and a couple other things. My question is, how do you know what verbs are available to use in the URI?

       

      This will query and return some things I wanted to know about a node. I understand the query part pretty well, but have issues with the other commands.

       

      Invoke-RestMethod -Uri ("https://"+$Hostname+":17778/SolarWinds/InformationService/v3/Json/Query?query=

          SELECT Nodes.NodeID, Nodes.Uri, Nodes.Caption, NodesCustomProperties.Service_State_Notification, NodesCustomProperties.Application

          FROM Orion.Nodes

          Join Orion.NodesCustomProperties

          On Nodes.NodeID=NodesCustomProperties.NodeID") `

          -Credential $orioncred -ContentType "application/json"


      So to create a node you use something like this

       

      Invoke-RestMethod -Uri ('https://192.168.56.15:17778/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes') `

      -Credential  $orioncred  -ContentType "application/json" -Method POST -Body ($newnode) -Verbose

       

      It took me a while to figure out you had to CREATE  and I only found this by hunting down examples. Is there a resource that gives me a more in depth overview of the different functions/commands to send in REST?

       

      I figured this one out by reading through the SDK help files. It deletes a node, and I understand it because it uses a -Method Delete.

       

      Invoke-RestMethod -Uri ("https://"+$Hostname+":17778/SolarWinds/InformationService/v3/Json/"+$Swis) `

                                    -Credential  $orioncred -ContentType "application/json" -Method Delete

       

      So how do I find out how to do all of the amazing things you can do with the REST method? We don't want to use the built in PS module. Any help is appreciated.