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:"test1",ClientUserId:"SFG"</assign>
<assign to="jsoninput1" from="/ProcessData/PrimaryDocument/@*"></assign>
</output>
<input message="xin">
<assign to="." from="*"></assign>
</input>
</operation>
------------------------------
Doyle Collings
------------------------------
Original Message:
Sent: Mon October 21, 2024 05:55 AM
From: Mirjana Vojvodic
Subject: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document
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
Original Message:
Sent: Fri October 18, 2024 02:56 PM
From: Doyle Collings
Subject: How to use the IBM Sterling B2B Integrator REST API Client Service to POST JSON data from Process Data or the Primary Document
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
------------------------------