Table of contents

Develop applications for Data Science Experience Local

DSX Local provides REST APIs to perform a variety of tasks. The following tasks require user authentication to run:

User authentication

DSX Local requires a bearer token to authenticate the user calling the REST APIs. The token lasts for 13 hours. The following example shows how to retrieve a bearer token from the user management service:

curl -k -X GET https://9.87.654.321/v1/preauth/validateAuth -u joe:joespasswd

where 9.87.654.321 represents the hostname for the master node, joe represents a user that exists in DSX Local, and joespasswd represents the password.

The call returns a JSON from which the bearer token can be extracted from the accessToken field:


The value of the accessToken field can be stored into a variable that can be used for authenticate subsequent operations. Example:

bearerToken=`curl -k -X GET https://9.87.654.321/v1/preauth/validateAuth -u joe:joespasswd | jq -r '.accessToken'`

The user ID value in the uid field indicates the home directory of the user, for example, /user-home/1003/. The uid can be used to refer to local files that your Spark application might want to process.