Using an access token in Cloudera Data Engineering API calls

Cloudera Data Engineering (CDE) uses JSON Web Tokens (JWT) for API authentication.

Get an access token and save it as an environment variable as described in Getting a Cloudera Data Engineering API access token.

  1. Determine the API URL for the virtual cluster you want to access using the API. The API URL for managing jobs is different from the URL used to obtain the access token.
    1. In the Cloudera Data Platform (CDP) console, click the Data Engineering tile. The CDE Home page displays.
    2. In the Virtual Clusters section, navigate to the virtual cluster for which you want to interact with, and click Cluster Details.
    3. Click JOBS API URL to copy the link to your clipboard.
      For example: https://pmjkrgn5.cde-czlmkz4y.na-01.xvp2-7p8o.cloudera.site/dex/api/v1
  2. When you make an API call, include the JWT as a bearer token. For example, to list all jobs associated with the virtual cluster, assuming you have saved the token as an environment variable named CDE_TOKEN:
    curl -H "Authorization: Bearer ${CDE_TOKEN}" -H "Content-Type: application/json" -X GET "https://pmjkrgn5.cde-czlmkz4y.na-01.xvp2-7p8o.cloudera.site/dex/api/v1/jobs"