Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: REST Client - How do I do this?

  1. #1
    Join Date
    Sep 2010
    Posts
    8

    Default REST Client - How do I do this?

    I would like to use the Pentaho pdi "REST Client" to post and create users in our data warehouse (GoodData Cloud BI). I understand how to format the curl/JSON (see below). However, I do not know where each of these pieces go in the the REST Client step (or preceding Generate Rows step). I would be very grateful if someone can explain this.

    Here is the REST curl/JSON to login:

    $ curl --cookie cookies.txt \
    --data-binary @- \
    --header 'Accept: application/yaml' \
    --header 'Content-Type: application/json' \
    https://secure.gooddata.com/gdc/account/login <<EOR
    {
    "postUserLogin" : {
    "login" : "user@example.com",
    "password" : "S3kr1TZ",
    "remember" : "0"
    }
    }
    EOR
    ---
    userLogin:
    profile: /gdc/account/profile/409
    state: /gdc/account/login/409

    Here is the the REST curl/JSON to create a user:
    curl -d @request.json --header "Content-Type: application/json"
    --header "Accept: application/json" --cookie "GDCAuthTT=your TT
    token"
    --insecure
    https://secure.gooddata.com/gdc/account/domains/$domain/users

    {

    "accountSetting":{
    "login": "user@login.com",
    "password":"PASSWORD",
    "verifyPassword":" PASSWORD ",
    "firstName":"FirstName",
    "lastName":"LastName",
    "companyName":"CompanyName",
    "position":"",
    "country":"us;al",
    "timezone":null,
    "ssoProvider":"SSO-Provider",
    "phoneNumber":"+420 123 456 78"
    }

    }

    POST - <accountSetting> returns
    - (403 Forbidden)
    - (400 Bad request)
    - (201 Created) % an uri of newly created user in format
    /account/profile/$user

  2. #2
    Join Date
    Sep 2009
    Posts
    810

    Default

    Hey Silvey,

    I guess it's just about setting the headers, and putting the json text into the body field.
    If there is a test account to play with, I'd try for you

    Cheers
    Slawo

  3. #3

    Default

    Hi there folks.
    I'm stuck in a subject about posting with REST Client.
    I have a webservice running on JBoss plataform.
    When I try to communicate with it by Kettle using GET method with no parameters, everything works OK.
    But when i Try to POST something, It never succeeds.
    The method is consuming a XML. In order to test:
    1-I'm creating the fields with "Generate Rows" input;
    2- transforming it into a XML using "Add XML"
    3- Calling the Webservice using POST method
    Name:  rest_flow.jpg
Views: 2925
Size:  37.7 KB

    The answer i get from the Webservice results in an Error from JBoss as follows:

    HTTP Status 415 - Unsupported Media Type
    type
    Status report
    message Unsupported Media Type
    description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Unsupported Media Type).
    JBossWeb/2.0.1.GA
    I already tried to change xml encoding, to send the parameter in header instead of body field, unsuccessfully...

    Edited: I used HTTP Post transform instead of REST Client and It worked. Is it possible to have the same result using REST Client Transform with POST method? How?
    Last edited by gabrielmendes; 10-31-2011 at 12:08 PM.

  4. #4
    Join Date
    Oct 2014
    Posts
    26

    Default

    Quote Originally Posted by gabrielmendes View Post
    Hi there folks.
    I'm stuck in a subject about posting with REST Client.
    I have a webservice running on JBoss plataform.
    When I try to communicate with it by Kettle using GET method with no parameters, everything works OK.
    But when i Try to POST something, It never succeeds.
    The method is consuming a XML. In order to test:
    1-I'm creating the fields with "Generate Rows" input;
    2- transforming it into a XML using "Add XML"
    3- Calling the Webservice using POST method
    Name:  rest_flow.jpg
Views: 2925
Size:  37.7 KB

    The answer i get from the Webservice results in an Error from JBoss as follows:

    I already tried to change xml encoding, to send the parameter in header instead of body field, unsuccessfully...

    Edited: I used HTTP Post transform instead of REST Client and It worked. Is it possible to have the same result using REST Client Transform with POST method? How?
    There is a patch on PDI-14743 to enable proper binary transfer instead of String when using Rest Client.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.