AnsweredAssumed Answered

Add Credentials to Site using Nexpose API, cURL & M

Question asked by Derek Davenport on Jan 30, 2017
Latest reply on Jan 31, 2017 by Derek Davenport

I've been avoiding using the Ruby gem to interact with the Nexpose API.  I don't know Ruby and I hate installing extra stuff on my servers.  I've been using cURL and XML and been pretty successful with it so far, but right now I am stumped!  Please help!

 

I am trying to add a single host's credentials to an existing site.  I am reading the API guide and it looks like I should use the "SiteSaveRequest" to accomplish this, but it looks like you might need to pull the entire site's config, modify it and re-save it.  Is this correct?

 

Is there not a way to just reference an existing site and just add or modify a single configuration?  Something like below?

 

If I post the XML below to the API, I get the error at the bottom.

 

Any help or guidance would be greatly appreciated.

 

<SiteSaveRequest session-id="<session variable goes here>">

  <Site id="<site id goes here>" name="<site name goes here">

  <Credentials>

  <adminCredentials name="test_creds" service="ssh" host="10.200.160.60" port="22" USERID="test" PASSWORD="test" />

  </Credentials>

  </Site>

</SiteSaveRequest>

 

 

<SiteSaveResponse success="0">

<Failure>

<Exception>

<message>java.lang.NullPointerException</message>

<stacktrace></stacktrace>

</Exception>

</Failure>

</SiteSaveResponse>

Outcomes