I'm connecting to a rest API. The API provider previously accepted Login Requests to return an API key by passing the credentials as a query string in the URL.
This was working fine for me by using
However, the API provider has now deprecated this method and requires the credentials to be passed in the body, e.g. this is the API Spec.
Sample POST Request
POST https://pi.pardot.com/api/login/version/3 HTTP/1.1 email=<email>&password=<password>&user_key=<user_key>
Parameter Required Description
|X||The email address of your user account|
|password||X||The password of your user account|
|user_key||X||The 32-character hexadecimal user key for your user account|
If authentication was successful, a 32-character hexadecimal API key will be returned in the following format:
<rsp stat="ok" version="1.0"> <api_key>5a1698a233e73d7c8ccd60d775fbc68a</api_key> </rsp>
Otherwise, the response will contain the following:
<rsp stat="fail" version="1.0"> <err code="15">Login failed</err> </rsp>
I'm unable to get this to work. My revised job is as below. I'm using a tFixedFlow input to pass the credentials via a tMap into the string field of the tRest (I will used context variables to hold the relevant credentials in due course). However, I can seem to get this to work, what am I doing wrong? I know my credentials are good as I can get them to work via SOAP UI. I'm assuming I have something wrong with the syntax of the string I'm passing through. Of course because it's a logon and for security reasons the response from the API doesn't provide much clue as to what the problem is.
I ended up using the tFileFetch to make the connection. The response was saved to a cache which I parsed to get the api key.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema