2 Replies Latest reply on Sep 13, 2017 5:55 AM by Pankaj Birje

    BCM WebAPI

    Pankaj Birje

      Hello All,

       

      I am working with BCM WebAPI and trying to assign a device to OP rule through BCM API.

       

      Its Working with the API Documentation url i.e. http://localhost:1611/wsdoc with console credentials.

       

       

      When i am copying the same request URL to another internet explorer it gives below error.

       

      Also i installed the REST client add-on in browser and executed the same url with authentication, it works.

       

      is there any way to execute the url with credentials using script or we can able to provide credentials directly to URL ?

       

      kindly help on this.

       

      Regards,

      Pankaj

        • 1. Re: BCM WebAPI
          Jacob Olesen

          Hi

          I use powershell to assign some device groups to op rules

           

          $server = "YOUR BCM SERVER"

          $user = "YOUR BCM API USER"

          $pass = "Password of your API USER"

           

           

          $pair = "${user}:${pass}"

          $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)

          $base64 = [System.Convert]::ToBase64String($bytes)

          $basicAuthValue = "Basic $base64"

          $headers = @{ Authorization = $basicAuthValue }

           

          $url = "https://${server}:2616/api/1/oprule/rule/${RuleID}/device/group/${GroupID}?activation=manual"

          $object = Invoke-RestMethod -Method PUT -Uri $url -Headers $headers

          $object.assignment.id #Will display the assignment ID

          • 2. Re: BCM WebAPI
            Pankaj Birje

            Hi Jacob,

             

            Thank you so much.....

            It works.

             

            Regards,

            Pankaj