App Connect

App Connect

Join this online user group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Sending POST request with content type 'application/x-www-form-urlencoded'

    Posted Tue August 16, 2022 12:02 PM

    Hi folks,

    I'm trying to see if I can send POST request with content type 'application/x-www-form-urlencoded' to IBM Datapower.
    Using REST Request node, it looks like IBM AppConnect does not currently offer support for "formData". 

    LocalEnvironment

                    Destination

                                                    REST

                                                                                    Request

                                                                                                                    ContentType:CHARACTER:application/x-www-form-urlencoded

                                                                                                                    Accept:CHARACTER:application/json

                                                                                                                    BaseURL:CHARACTER:https://MASKED

                                                                                                                    UserID:CHARACTER:MASKED

                                                                                                                    Password:CHARACTER:MASKED

                                                                                                                    Parameters

                                                                                                                                    password:CHARACTER:MASKED

                                                                                                                                    client_id:CHARACTER:MASKED

                                                                                                                                    client_secret:CHARACTER:MASKED

                                                                                                                                    grant_type:CHARACTER:MASKED

                                                                                                                                    username:CHARACTER:MASKED

                                                                                                                                    acr_values:CHARACTER:MASKED

                                                                                                                                    scope:CHARACTER:MASKED


    Text:CHARACTER:Don't know how to propagate the value of this parameter

                                                                                                                                                                                                                    Insert

                                                                                                                                                                                                                                                    Type:INTEGER:5

                                                                                                                                                                                                                                                    Text:CHARACTER:Don't know how to propagate the value of this parameter


    My question is if there is any alternative method to post request with content type 'application/x-www-form-urlencoded'




    ------------------------------
    Michael Bae
    ------------------------------


  • 2.  RE: Sending POST request with content type 'application/x-www-form-urlencoded'

    Posted Wed August 17, 2022 05:28 AM
    Dear Michael,

    Using HTTP Request Node, you can send POST requests with content type application/x-www-form-urlencoded.
    I'm not sure if it's the same for Rest Request Nodes.

    DECLARE redirecturi,granttype,clientsecret,authcode,Data CHARACTER;
    SET redirecturi = 'redirecturi';
    SET granttype = 'authorization_code';
    SET clientsecret = 'clientsecret'
    SET authcode = 'authcode';

    SET Data = 'redirect_uri=' || redirecturi || '&grant_type=' || granttype || '&client_secret=' || clientsecret || '&code=' || authcode;
    SET OutputRoot.HTTPRequestHeader."Content-Type" = 'application/x-www-form-urlencoded';
    SET OutputRoot.BLOB.BLOB = CAST(Data AS BLOB CCSID 1208);

    ------------------------------
    Anoop C Pillai
    ------------------------------



  • 3.  RE: Sending POST request with content type 'application/x-www-form-urlencoded'

    Posted Wed August 17, 2022 12:34 PM
    Thanks Anoop, using OutputRoot.BLOB.BLOB with HTTP Request Node did create a valid request.

    ------------------------------
    Michael Bae
    ------------------------------