B2B Integration

 View Only
Expand all | Collapse all

How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

  • 1.  How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

    Posted Fri October 18, 2024 02:56 PM

    What is the BPML syntax to reference Process Data or the Primary document in a REST API Client Service JSON POST

    We are able to successfully POST JSON data that is directly coded in the body of the jsoninput1 parameter using the following syntax example found at https://www.ibm.com/docs/en/b2b-integrator/6.2.0?topic=z-rest-api-client-service:
    <assign to='jsoninput1'> "key1": "value", "key2": "value2" </assign>

    but when we try to reference Process Data that contains the same JSON script using the the jsoninput1 parameter 

    <assign to='jsoninput1'> "/ProcessData/ExportAccountsJSON" </assign>

    it POST's the literal path of the reference "/ProcessData/ExportAccountsJSON"



    ------------------------------
    Doyle Collings
    ------------------------------


  • 2.  RE: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

    Posted Mon October 21, 2024 12:52 AM

    Hi Doyle,

    never used the adapter but it should look like this:

    <assign to='jsoninput1' from="/ProcessData/PrimaryDocument/@*"/>

    Best regards

    Manuel



    ------------------------------
    Manuel Frank
    Integration Architect
    Andreas STIHL AG & Co. KG
    Waiblingen
    ------------------------------



  • 3.  RE: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

    Posted Mon October 21, 2024 12:53 AM

    Wouldn't it just be the same as any other assigning a value into a Process Data element. 

    <assign to='jsoninput1' from='/ProcessData/ExportAccountsJSON/text()' />



    ------------------------------
    Vivek Mittal
    Director
    Archisage Pty Ltd
    ------------------------------



  • 4.  RE: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

    Posted Mon October 21, 2024 05:55 AM

    Hello Doyle,

    You did not tick off the Xpath box in GPM.

    Please pay attention to the difference when value of element is defined as constant in bpml code:

    <assign to="jsoninput1"> "/ProcessData/ExportAccountsJSON" </assign>

    ... and as XPath:

    <assign to="jsoninput1" from="/ProcessData/ExportAccountsJSON"></assign>

    Kind regards,

    Mirjana



    ------------------------------
    Mirjana Vojvodic
    ------------------------------



  • 5.  RE: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document

    Posted Thu October 24, 2024 09:06 AM
    Edited by Doyle Collings Thu October 24, 2024 09:09 AM

    It appears that the jsoninput1 parameter does not recognize the XPATH statement.  A trace from the REST API consumer shows brackets surrounding data which means that the jsoninput1 parameter is treating everything within its value as JSON data. 
    { from="/ProcessData/PrimaryDocument/@*">}

    The following code with the obfuscated url target and bearer token is below

          <sequence name="SSGotData">
            <assign name="Assign" to="/ProcessData/ExportAccountsJSON" from="/ProcessData/PrimaryDocument/@*"></assign>
            <operation name="ExportAccountsJSON">
              <participant name="RESTAPIClient"/>
              <output message="xout">
                <assign to="restoperation">POST</assign>
                <assign to="url">https://resttargeturl.com</assign>
                <assign to="Content-type">application/json</assign>
                <assign to="Accept">application/json</assign>
                <assign to="Authorization">Bearer</assign>
                <assign to="auth">0a9s8f7as9f87098asf7ds0987sd</assign>
                <assign to="headers">X-RqUID:&quot;test1&quot;,ClientUserId:&quot;SFG&quot;</assign>
                <assign to="jsoninput1" from="/ProcessData/PrimaryDocument/@*"></assign>
              </output>
              <input message="xin">
                <assign to="." from="*"></assign>
              </input>
            </operation>

     



    ------------------------------
    Doyle Collings
    ------------------------------