cancel
Showing results for 
Search instead for 
Did you mean: 

Testting NBU 8.1.1's API with curl

AScarparo
Level 1

Hi everyone, I´m testing the NBU API´s but follow documentation I can not have success.
First of all, using these line doesn´t work:

content-type: application/vnd.netbackup+json;version=1.0

I get some progress when changing to 

content-type:application/json;version=1.0

After this authenticate failed, but documentation is clear about wich credencial I need to provide, follow my request

curl -X POST https://nb-master.lab.pvt:1556/netbackup/login -H Content-Type:applition/json;version=1.0' -d "{\"domainType\":\"vx\",\"domainName\":\"lab.pvt\",\"userName\":\"nbwebsvc\",\"password\":\"P@ssw0rd\"}" -k -v

What I´m doing wrong?

Output:

Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1...
* TCP_NODELAY set
* Connected to nb-master.lab.pvt (::1) port 1556 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=nb-master.lab.pvt; OU=TOMCAT@nb-master.lab.pvt; O=vx
*  start date: May 22 16:27:55 2018 GMT
*  expire date: May 22 17:42:55 2019 GMT
*  issuer: CN=broker; OU=root@nb-master.lab.pvt; O=vx
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /netbackup/login HTTP/1.1
> Host: nb-master.lab.pvt:1556
> User-Agent: curl/7.53.1
> Accept: */*
> Content-Type:application/json;version=1.0'
> Content-Length: 86
>
* upload completely sent off: 86 out of 86 bytes
< HTTP/1.1 401
< X-Request-ID: 14100D16F48029E3
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Mon, 28 May 2018 17:58:55 GMT
<
{"errorCode":160,"errorMessage":"authentication failed"}* Connection #0 to host nb-master.lab.pvt left intact
1 REPLY 1

Mouse
Moderator
Moderator
Partner    VIP    Accredited Certified

While I am not sure about the settings in your environment, usually nbwebsvc is a service account with no rights in NBU. I would try a user account that can be used to log in to the Java console.