Implementing Talend Data Preparation REST API authentication - 2.3

Talend Data Preparation User Guide

author
Talend Documentation Team
EnrichVersion
6.5
2.3
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
task
Data Quality and Preparation > Cleansing data
EnrichPlatform
Talend Data Preparation
Sometimes you may need to access Talend Data Preparation REST API and perform a set of actions such as tracking the audit events or retrieving user information. To do so you need to implement an API authentication and authorization method.

Before you begin

You have installed and launched all Talend Data Preparation modules.

Procedure

  1. Open a terminal and execute a POST request to call a login API.
    This API provides an authentication token in the authorization response header. Below is a sample login POST request and response.
    curl -v <tdp_url>/login -F username=<username> -F password=<password>
    > POST /login HTTP/1.1
    > Host: tal-rd44.talend.lan:9999
    > User-Agent: curl/7.62.0
    > Accept: */*
    > Content-Length: 258
    > Content-Type: multipart/form-data; boundary=------------------------6b078f179b82dd6a
    > 
    < HTTP/1.1 200 OK
    < Date: Thu, 20 Dec 2018 13:43:15 GMT
    < Cache-Control: no-cache, no-store, must-revalidate
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < X-Application-Context: application:server-standalone:9999
    < Access-Control-Expose-Headers: Authorization
    < Authorization: Bearer c32d3138d93c25993945dc87888387a
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < X-Frame-Options: DENY
    < Set-Cookie: SESSION=85147f00-e6e7-4bb9-b377-7930e4b860e7;Path=/;HttpOnly
    < Content-Length: 0
    < 
  2. In Talend Data Preparation API calls, set the authentication token value in the Authorization header.
    Below is a sample request and response to retrieve information on the current user.
    curl 'http://tal-rd44.talend.lan:9999/api/user' -H 'Authorization: Bearer c32d3138d93c25993945dc87888387a'