Part 3: Authentication
Log in to use Nuix REST.
2 minute read
Now that you know your server is properly installed and configured, the first thing you will want to do is authenticate.
curl --location --request PUT 'http://localhost:8080/nuix-restful-service/svc/v1/authenticatedUsers/login' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"username":"username",
"password":"password",
"licenceShortName": "enterprise-workstation",
"workers": 2
}'
{
"username": "username",
"authToken": "9729a460-eda7-48dc-ba70-d12b3aae3c8d",
"licenseShortName": "enterprise-workstation",
"workersGranted": 2
}
Note
ThelicenceShortName
and workers
fields in the request body are optional. If they are excluded any license will be selected and
1 worker will be granted.
Note
Please note theauthToken
field returned in the response will need to be submitted in the nuix-auth-token
request header field on all subsequent requests.
Alternatively, you can use the following example script to log in.
import requests
import json
username="YOURUSERNAME"
password="YOURPASSWORD"
licenseType="enterprise-workstation"
numberOfWorkders=2
base_url = "{{host}}:8080/nuix-restful-service/svc"
headers = {"Content-Type":"application/json"}
request_body = {
"username":username,
"password":password,
"licenseShortName": licenseType,
"workers": numberOfWorkers
}
def getToken():
try:
response = requests.put(base_url + "/v1/authenticatedUsers/login", data=json.dumps(request_body), headers=headers)
token = response.json()['authToken']
print("Successful retrived token: {}".format(response.json()['authToken']))
except Exception as e:
print(e)
getToken()
import requests
import json
username="YOURUSERNAME"
password="YOURPASSWORD"
licenseType="enterprise-workstation"
numberOfWorkders=2
base_url = "{{host}}:8080/nuix-restful-service/svc"
headers = {"Content-Type":"application/json"}
request_body = {
"username":username,
"password":password,
"licenseShortName": licenseType,
"workers": numberOfWorkers
}
def getToken():
try:
response = requests.put(base_url + "/v1/authenticatedUsers/login", data=json.dumps(request_body), headers=headers)
token = response.json()['authToken']
print("Successful retrived token: {}".format(response.json()['authToken']))
except Exception as e:
print(e)
getToken()
You have now successfully authenticated to Nuix RESTful Service!
Feedback
Was this page helpful?
Thank you for your feedback.
Thank you for your feedback.