API Connect

API Connect

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
  • 1.  Handle 400 Bad Request-One or more required API parameters are missing in the API request Globally with custom JSON

    Posted Wed September 13, 2023 06:08 AM
    Edited by pratap vadlapati Thu September 14, 2023 05:22 AM

    Hi 

    we tried to configure global-error policy, but we are facing issues and unable to capture 400 Bad request.

    1. Global error Policy is not triggering until we configure throw action in the API assembly Flow.Is this how it works?, I assume it should trigger for any error returned from API.
    2. Even if have throw action configured for specific 400 Bad Request Error, global-error-policy is not triggered.Currently its returning as below instead of custom json FYR:     {
          "httpCode": "400",
          "httpMessage": "Bad Request",
          "moreInformation": "One or more required API parameters are missing in the API request."
      }
    3. sample global error policy we configured as below. and i can see catch config in Datapower API Rule.
      global-policy: 1.0.0
       
      info:
        name: sample-error-policy
        title: Sample Error Policy
        version: 2.0.0
       
      gateways:
        - datapower-api-gateway
       
      assembly:
        catch:
          - errors:
              - ConnectionError
              - UnauthorizedError
              - BadRequestError
              - ForbiddenError
              - SOAPError
            execute:   
                - xslt:
                    version: 2.0.0
                    title: xslt
                    input: false
                    source:  <xslt/> to return custom json



    ------------------------------
    pratap vadlapati
    ------------------------------



  • 2.  RE: Handle 400 Bad Request-One or more required API parameters are missing in the API request Globally with custom JSON

    Posted Mon September 18, 2023 03:11 PM

    Duplicate post made part of https://community.ibm.com/community/user/integration/discussion/gateway-script-error-and-exception-handling?ReturnUrl=%2fcommunity%2fuser%2fintegration%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3d2106cca0-a9f9-45c6-9b28-01a28f4ce947 was answered there.
    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------