Junos Automation (Scripting)
Junos Automation (Scripting)

Unable to enable REST API

‎09-29-2019 10:01 AM

Hello All,

 

Unable to enable REST API on vSRX (19.2), getting a 403 Forbidden error , any help is appreciated 

 

***

 

set system services rest http port 3000
set system services rest http addresses 0.0.0.0
set system services rest control allowed-sources 0.0.0.0
set system services rest control connection-limit 100
set system services rest traceoptions flag all
set system services rest enable-explorer

 

****

 

set security zones security-zone trust host-inbound-traffic system-services any-service
set security zones security-zone trust host-inbound-traffic protocols all

 

**

 

admin@sjc-pm-vSRX1> show system connections | match 3000
tcp4 0 0 *.3000 *.* LISTEN

3 REPLIES 3
Junos Automation (Scripting)

Re: Unable to enable REST API

‎09-29-2019 06:59 PM

Hello rajan_37,

 

Please configure valid http addresses where the device can listen on and test if that works.

 

Hope this helps.

 

Regards,
-r.

--------------------------------------------------

If this solves your problem, please mark this post as "Accepted Solution."
Kudos are always appreciated Smiley Happy.

Junos Automation (Scripting)

Re: Unable to enable REST API

‎09-30-2019 01:12 PM

Thanks a lot for responding back @mriyaz 

 

I updated the config to reflect the mgmt ip address of the FW but still no luck. Getting the 403 forbidden error 

 

set system services rest http addresses 172.20.22.132

Highlighted
Junos Automation (Scripting)

Re: Unable to enable REST API

[ Edited ]
‎10-24-2019 07:00 AM

Where are you seeing the error '403 Forbidden' This doesn't seem to me like a problem with your REST config on your device. It seems more likely a problem with the way you are making your request. Can you curl to your device from a linux machine? (Change IP address and username/password in the below request)

 

curl http://ipaddress:3000/rpc/get-software-information -u "username:password" -H "Content-Type: application/xml" -H "Accept: application/json"