cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

NBU 8.2 REST API Key authentation error

Hello, I am new and trying to get to learn about the NBU REST API. I have read the "NetBackup™ 8.2 API - Getting Started" guide and performed the exact same steps mentioned under "Example of generating and using an API key for authentication" but having some trouble authentating with the API key. Below are the steps I performed.

1. Using used id and pwd successfully generated the JSON Web Toekn using the POST /login api.
2. Added the JWT in the Authorization header.
3. Then, successfully got the backup job details using GET /admin/jobs/{jobId} ----(Did this step for testing JWT token)
4. I used the same JWT and successfully generated the API Key using POST /security/api-keys api.
5. I replaced the JWT with API Key in the Authorization header.
6. Tried GET /admin/jobs/{jobId} api to get the same job id used in Setp 3 but seeing below error in response body.

{
"errorCode": 8000,
"errorMessage": "The user does not have permission to perform the requested operation.",
"attributeErrors": {},
"fileUploadErrors": [],
"errorDetails": []
}

Please let me know if I am missing anything in my process.

Thanks!

Tags (2)
4 Replies
Highlighted

Re: NBU 8.2 REST API Key authentation error

When you created API key what string did you get? For example:

API key for user myuser with 1 year validity

 

Highlighted

Re: NBU 8.2 REST API Key authentation error

This is the POST cmd used to create the API Key:

curl -X POST "https://master IP address/netbackup/security/api-keys" -H "accept: application/vnd.netbackup+json;version=3.0" -H "Authorization: <JSON Token>" -H "Content-Type: application/vnd.netbackup+json;version=3.0" -d "{ \"data\": { \"type\": \"apiKeyCreationRequest\", \"attributes\": { \"expireAfterDays\": \"P1D\", \"description\": \"API Key for user nbapisvc\" } }}"

And got below response with code 201:

{
"data": {
"links": {
"self": {
"href": "/netbackup/security/api-keys/Ay8-_AlIAhY="
}
},
"type": "apiKeyCreationResponse",
"id": "<KEY Tag>",
"attributes": {
"apiKey": "<KEY>",
"expiryDateTime": "2020-04-07T17:36:31.888Z"
}
}
}

When I use GET to view the API KEY details

{
"data": [
{
"links": {
"self": {
"href": "/netbackup/security/api-keys/Ay8-_AlIAhY="
}
},
"type": "apiKeyDetails",
"id": "<KEY Tag>",
"attributes": {
"userName": "nbapisvc",
"userDomain": "",
"userDomainType": "unixpwd",
"createdDateTime": "2020-04-06T17:36:31.900Z",
"lastModifiedDateTime": "2020-04-06T17:36:31.900Z",
"expiryDateTime": "2020-04-07T17:36:31.888Z",
"description": "API Key for user nbapisvc"
}
}
],

To answer to your question, I have provided the string and created the token for 1 day (24 hrs).

Highlighted

Re: NBU 8.2 REST API Key authentation error

1) Did you try the same for the root/Administrator user?

2) Have you done this for the user nbapisvchttps://www.veritas.com/support/en_US/article.100042908

Highlighted

Re: NBU 8.2 REST API Key authentation error

Hi,

The account that you are using to authenticate, is it a backup admin or security admin on RBAC? Please try with backup admin, it should be able to query the catalog.