webMethods

webMethods

Join this online 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
Expand all | Collapse all

Creating a mock rest API which receives data via x-www-form-urlencoded

  • 1.  Creating a mock rest API which receives data via x-www-form-urlencoded

    Posted Sat April 01, 2023 06:24 AM

    Hello,

    I am trying to create a mock API which should receive specific parameters via x-www-form-urlencoded and return the output as application/json. For this, I created a rest resource which calls a service having inputs matching the inputs passed in Body - x-www-form-urlencoded in Postman. Http method is GET. However, when I send the request using Postman I can’t see anything in the pipeline.
    According to the documentation (https://documentation.softwareag.com/webmethods/integration_server/pie10-15/webhelp/pie-webhelp/index.html#page/pie-webhelp%2Fto-content_handlers_5.html%23) is says that when content type is application
    /x-www-form-urlencoded then the content handler decodes an incoming input stream and converts the content to key/value pairs. If the key already exists, the value is added to a list in the pipeline with the key key+list.
    For returning the output as application/json I managed to do this using setResponse service but I just can’t get the inputs from Postman. Do you have any idea how I can achieve this?

    Thanks,
    n23


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Creating a mock rest API which receives data via x-www-form-urlencoded

    Posted Mon April 03, 2023 03:22 AM

    Hi @niemand23,

    Can you please specify which version of Integration Server you are using? Also, have you applied the latest fixes? If not, what’s the fix version you are on? Have you see any errors in the server log of Integration Server? Is this licensed version or trial version?

    Thanks,
    Sree


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Creating a mock rest API which receives data via x-www-form-urlencoded

    Posted Mon April 03, 2023 03:35 AM

    Hi,

    I am using Integration Server version 10.7 (IS_10.7_Core_Fix3). Is is the licensed version. Do you think it might be fix level related?
    What should be the expected behavior in this case?

    n23


    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Creating a mock rest API which receives data via x-www-form-urlencoded

    Posted Tue April 04, 2023 03:37 AM

    Hello @niemand23 ,
    Can you please provide more details about the scenario? What are some sample inputs you are passing in Postman, what is the HTTP method in Postman? some screen shots will help as well.
    You can try adding a pub.flow:tracePipeline call in the flow service as the first step to confirm the data that is reaching the flow service.

    -NP


    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: Creating a mock rest API which receives data via x-www-form-urlencoded

    Posted Sun April 30, 2023 05:05 PM

    for GET method, the request-body has no semantic meaning. Try use other methods POST or PUT.


    #webMethods
    #Integration-Server-and-ESB