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

Consuming rest api in json format

  • 1.  Consuming rest api in json format

    Posted Sun April 28, 2019 07:56 PM

    Hi all,

    I have a task to consume rest API and save the data into database.
    the format of json is like this :
    [{
    “id”:123,
    “phone”:123,
    “experience”:[{
    “a”:1,
    “b”:1,
    }],
    “test”:aa
    }]
    so i create a document, inside the document i add document list which contain string id,phone,experience, document list (experience) that contain string a,b, and string test.
    the rest API i call with pub.http.client withe get method, and i set loadAs as stream.
    After that the stream i map into string with pub:io:streamToString and create a document with jsonStringToDocument.

    I run the flow and it success, the document show the document list with structure $rootArray and inside it $rootArray[0],[1],etc.
    So i insert map step, and drag my created doc into pipeline out, let say my doc name is doc_a.
    I try to expand document from pipeline in but there is no sub document at all, so i direct connecting both document and i run the service, and the result my doc_a is not mapped with document generated from jsonStringToDocument.

    Please help me how to do the map? or any advise and instruction

    Thank you


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods