webMethods

 View Only
Expand all | Collapse all

Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

  • 1.  Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

    Posted Sun September 08, 2024 09:00 AM

    Hi everyone,

    I’m currently working with webMethods API Gateway and running into an issue with accessing data from a application/x-www-form-urlencoded request.

    Here’s the setup:

    • Request Type: POST
    • Content-Type: application/x-www-form-urlencoded
    • Request Example:
    POST /submitSMT HTTP/1.1
    Content-Type: application/x-www-form-urlencoded
    Authorization: abc123
    
    jobId=1234&status=complete&priority=high
    
    • Goal: I need to extract the form data parameters (jobId, status, and priority) from the request body.

    What I’ve Tried So Far:

    In my API Gateway policy, I’ve tried using the following expressions to access the form data:

    token=${request.headers.Authorization}
    jobId=${request.body.get('jobId')}
    status=${request.body.get('status')}
    priority=${request.body.get('priority')}
    

    However, the response I get looks like this:

    token=abc123
    jobId=${request.body.get('jobId')}
    status=${request.body.get('status')}
    priority=${request.body.get('priority')}
    

    It seems like the form data isn’t being parsed or accessed properly.

    I also tried accessing the data via request.payload but didn’t have any success there either.

    Questions:

    1. How should I correctly access form data from the request body in webMethods API Gateway?
    2. Are there any specific methods or syntax for handling application/x-www-form-urlencoded data?

    Any help or guidance would be greatly appreciated!

    Thanks in advance!


    #API-Gateway
    #API-Management
    #webMethods


  • 2.  RE: Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

    Posted Wed September 11, 2024 05:07 AM


  • 3.  RE: Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

    Posted Wed September 11, 2024 06:12 PM

    If you need urgent support, I recommend creating a ticket and marking it as critical. Unfortunately my API gateway knowledge is pretty limited, I would have helped you if I could.


    #API-Management
    #API-Gateway
    #webMethods


  • 4.  RE: Help Needed: Accessing application/x-www-form-urlencoded Data in webMethods API Gateway

    Posted Mon September 16, 2024 05:47 PM

    Your syntax is incorrect as there is no “${request.body}” in the variable framework. To access variables from the query string, try using this syntax:
    ${request.query.jobId}

    Variable Framework (webmethods.io)

    HTH,
    Theo


    #API-Management
    #API-Gateway
    #webMethods