Pentaho

 View Only
Expand all | Collapse all

What is the data type returned for 'Result field name' of the "REST client" step? Can it be binary?

This thread has been viewed 4 times
  • 1.  What is the data type returned for 'Result field name' of the "REST client" step? Can it be binary?

    Posted 26 days ago

    Hello,

    I'm hoping someone can answer this question since I haven't found anything in the documentation.  I ask because it appears that PDI is stepping on the raw binary contained in the REST response - perhaps assuming a string value?  I'm just looking for some confirmation and whether there is a way to accept the response as binary and not a string.  The response header indicates that the Context-Type is "application\octet-stream".  

    Using Postman I'm able to save the response directly to a binary (*.jpg) file and it works fine.  Using PDI Rest client step the file is approximately 1k smaller in size, throws "unsupported file type" errors when trying to view, and it appears that most of the characters I see with Postman are instead converted to '?' (question marks) in the PDI output.

    The left shows characters changed to ?, right shows up as expected

    Is there a way to make sure that the Rest client 'Result field name' response output is preserved as binary?

    Thanks,

    --Ezra



    ------------------------------
    Ezra Wise
    Systems Engineer
    RightStar Inc.
    ------------------------------


  • 2.  RE: What is the data type returned for 'Result field name' of the "REST client" step? Can it be binary?

    Posted 3 hours ago

    Although I never received an answer to this question, I thought I'd pass along my findings in case someone else finds it useful.  The 'Result field name' does convert the content received in the response body and does not preserve its original binary format (if binary is returned).  I do not know if there is a way to force the data type to binary.  I was able to work around this apparent limitation by using a "User Defined Java Class" step and the 'httpconnect' method to return the rest response as binary.



    ------------------------------
    Ezra Wise
    Systems Engineer
    RightStar Inc.
    ------------------------------