How to make successful NGC API call for job creation as i am using API key but got UnAuthorized response?

Hello Everyone, Hope you all doing good.

I have URL for Nvidia NGC APIs so i want to make API call to run job creation on DGX ACE instance.

  • I have created NGC API key but each time i provide 5 to 6 information that normally we do in web interface like

  • aceInstance , dockerImageName , aceName , jobPriority , resultContainerMountPoint , runpolicy--> preemptClass , jobOrder

  • The total number of parent parameter is 38 and some has sub parameter but i am using the above information to create a job but every time i got UNAUTHORIZE error on response so i need help why i am unable to make a call.

  • Here is the API call for job creation:

curl -X 'POST' \
  'https://api.ngc.nvidia.com/v2/org/org_name/team/tema_name/jobs' \
  -H 'accept: application/json' \
  -H 'NV-AuthN-Token: N2tpbjd2Z####YzBiMGNsY2l##########mLTlmMWYtM#####MTllOWEz' \
  -H 'Content-Type: application/json' \
  -d '{
  "containerResources": {
    "requests": {
      "cpu": "string",
      "memory": "string"
    },
    "limits": {
      "cpu": "string",
      "memory": "string"
    }
  },
  "expTrackingParams": {
    "projectName": "string",
    "type": "NONE",
    "name": "string"
  },
  "userLabels": [
    "string"
  ],
  "aceId": 0,
  "resultsetMounts": {
    "containerMountPoint": "string",
    "id": "string",
    "mountMode": "RO"
  },
  "isLabelLocked": true,
  "jobType": "BATCH",
  "aceInstance": "################",
  "dockerImageName": "##############",
  "aceName": "#############",
  "jobVolumes": [
    {
      "name": "string"
    }
  ],
  "systemLabels": [
    "string"
  ],
  "envs": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "healthCheck": {
    "initialDelaySeconds": 0,
    "httpGet": {
      "path": "string",
      "port": 0
    },
    "timeoutSeconds": 0,
    "periodSeconds": 0
  },
  "jobOrder": 0,
  "sidecarContainers": [
    {
      "containerName": "string",
      "containerResources": {
        "requests": {
          "cpu": "string",
          "memory": "string"
        },
        "limits": {
          "cpu": "string",
          "memory": "string"
        }
      },
      "useImageEntryPoint": true,
      "dockerImageName": "string",
      "envs": [
        {
          "name": "string",
          "value": "string"
        }
      ],
      "healthCheck": {
        "initialDelaySeconds": 0,
        "httpGet": {
          "path": "string",
          "port": 0
        },
        "timeoutSeconds": 0,
        "periodSeconds": 0
      },
      "publishedContainerPorts": [
        0
      ],
      "portMappings": [
        {
          "protocol": "string",
          "name": "string",
          "hostPort": 0,
          "hostName": "string",
          "hostIP": "string",
          "containerPort": 0
        }
      ],
      "entryPoint": "string",
      "resultContainerMountPoint": "string",
      "command": "string",
      "datasetMounts": [
        {
          "containerMountPoint": "string",
          "id": 0,
          "uuid": "string"
        }
      ],
      "jobVolumeMounts": [
        {
          "containerMountPoint": "string",
          "name": "string",
          "mountMode": "RO"
        }
      ],
      "workspaceMounts": [
        {
          "containerMountPoint": "string",
          "id": "string",
          "mountMode": "RO"
        }
      ]
    }
  ],
  "reservedLabels": [
    "string"
  ],
  "topologyConstraint": "string",
  "workspaceMounts": [
    {
      "containerMountPoint": "string",
      "id": "string",
      "mountMode": "RO"
    }
  ],
  "description": "string",
  "useImageEntryPoint": true,
  "replicaCount": 0,
  "publishedContainerPorts": [
    0
  ],
  "jobPriority": "##########",
  "entryPoint": "string",
  "networkType": "INFINIBAND",
  "jobVolumeMounts": [
    {
      "containerMountPoint": "string",
      "name": "string",
      "mountMode": "RO"
    }
  ],
  "containerName": "string",
  "datasetMounts": [
    {
      "containerMountPoint": "string",
      "id": 0,
      "uuid": "string"
    }
  ],
  "name": "string",
  "runPolicy": {
    "minTimesliceSeconds": 0,
    "expirySeconds": 0,
    "totalRuntimeSeconds": 0,
    "preemptClass": "###############"
  },
  "arrayType": "MPI",
  "userSecretsSpec": [
    {
      "name": "string",
      "allKeys": true,
      "keysSpec": [
        {
          "envName": "string",
          "keyName": "string"
        }
      ]
    }
  ],
  "portMappings": [
    {
      "protocol": "string",
      "name": "string",
      "hostPort": 0,
      "hostName": "string",
      "hostIP": "string",
      "containerPort": 0
    }
  ],
  "command": "string",
  "minAvailability": 0,
  "initContainers": [
    {
      "containerName": "string",
      "containerResources": {
        "requests": {
          "cpu": "string",
          "memory": "string"
        },
        "limits": {
          "cpu": "string",
          "memory": "string"
        }
      },
      "useImageEntryPoint": true,
      "dockerImageName": "string",
      "envs": [
        {
          "name": "string",
          "value": "string"
        }
      ],
      "entryPoint": "string",
      "resultContainerMountPoint": "string",
      "command": "string",
      "datasetMounts": [
        {
          "containerMountPoint": "string",
          "id": 0,
          "uuid": "string"
        }
      ],
      "jobVolumeMounts": [
        {
          "containerMountPoint": "string",
          "name": "string",
          "mountMode": "RO"
        }
      ],
      "workspaceMounts": [
        {
          "containerMountPoint": "string",
          "id": "string",
          "mountMode": "RO"
        }
      ]
    }
  ],
  "resultContainerMountPoint": "########"
}'

response

{
  "requestStatus": {
    "statusCode": "UNAUTHORIZED",
    "statusDescription": "Not Authenticated",
    "requestId": "c85b9da5-2944662"
  }
}

how to slove this problem ?

  • I also tried to use use Python as mentioned in offifical doc , first they get token then they use get API .
  • So i tried token as bearer token in Authorization header but still got the same error??

Kindly help me out in this problem