IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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

Invoke GraphQL API using webMethods pub.client:http service

  • 1.  Invoke GraphQL API using webMethods pub.client:http service

    Posted Sun October 06, 2019 12:06 PM

    Hello,

    I have a requirement to consume GraphQL query in webMethods (version 9.12).

    It works fine with Postman using GraphQL feature, but somehow not able to get it to work from webMethods.

    Captured the network traffic to see what is being passed from Postman, so that same format can be replicated in webMethods. Converted the GraphQL query to JSON and then feed it to pub.client:http with all required header parameters and POST method, should work, but not working.

    Please guide, how to consume a GraphQA based API.

    Any help is very much appreciated!

    Regards,
    Manoj


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Invoke GraphQL API using webMethods pub.client:http service

    Posted Sun October 06, 2019 08:37 PM

    You can try to use “pub.string:URLEncode” by passing the GraphQL query string before invoking the client http (GET method) service.

    Or for POST, you can use JSON object and that should work.

    Refer, the demo graphql, which works fine in wM via client http service

    https://moonhighway.com/fetching-data-from-a-graphql-api


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Invoke GraphQL API using webMethods pub.client:http service

    Posted Mon October 07, 2019 09:23 AM

    I am able to successfully invoke the graphql endpoint. I have passed the query in below format using pub.client:http post method and the required headers like “Authorization” and “Content-Type” as “application/json”.

    {
    “query” : “mutation {
    data(_set:
    {
    flag: true,
    updated_by: "wM"
    }, where: {account: {_eq: "1234"}})
    {
    affected_rows
    returning {
    key
    updatedDate
    }
    }
    }”
    }


    #Integration-Server-and-ESB
    #webMethods