restpentahopentaho-spoonpentaho-data-integration

REST API calls through Pentaho Data Integration (Spoon)


Hello Pentaho Experts,

I am attempting to make a REST API call through REST Client in Pentaho. I have a Api key for authentication. I tried it in Postman, and it works perfectly fine, but Pentaho throws 403 status code. Below is the postman screenshot:

enter image description here

My Pentaho transformation contains two steps. I am passing URL through "Generate Rows" step and then adding Key and Value in the Header:

Generate Rows: enter image description here

Rest Client (General):

enter image description here

Rest Client (Header):

enter image description here

Any idea what I might be missing here? Expected output is JSON.


Solution

  • I can't speak to the use of passing key/value in Header for authentication, but what has worked for me is to use the Authentication tab to input my credentials or passing an Authentication header with a bearer token.

    Authentication Tab: I use this method to generate and return a bearer token from the API. The token is then used as the authentication method in subsequent steps. The "body" includes the scope (i.e.: "reports:read") and grant type ("client_credentials"). The "header" contains the value "application/x-www-form-urlencoded". Generate Rows Script body REST client General

    REST client Authentication

    REST client Header

    Authentication Header: Once a token has been returned from the API, this can be provided in an "authorization" header. Prepend "bearer" to the token value and pass this in the header tab. java script to build authorization header REST client General token

    REST client Headers token

    I would also recommend looking at the Headers being passed in Postman to ensure you are not missing anything else that might be happening in your call.