3) Posting XML and JSON in Postman

This Blog entry is from the Getting Started in Jube section in Learn Jube.

To develop a familiarisation in messaging the Jube platform a number of models are pre-configured in the platform with their messaging formats available in the following document:

http://download.jube.io/formats.pdf

These formats serve to introduce message formats the the different switches that are available to message processing. These formats will also be used regularly in subsequent Blog entries.

In this Blog entry, an Account Financial Transaction will be explored.

Firstly an XML post will be made with the querystring key value pair as follows:

EntityAnalysisModelGUID=253e427e-4523-40d2-b155-fcd5348e20e9

This querystring key value pair would be used in concert with the full endpoint specification if it was called from a programming language or a external HTTP post tool or utility:

https://api.jube.io?EntityAnalysisModelGUID=253e427e-4523-40d2-b155-fcd5348e20e9

To get started with the XML message, navigate to Administration >>> HTTP Post Tools >>> Postman:

1.PNG

In this example, XML is going to be posted. Click the XML radio button to ensure that the XML is formatted in the Postman page properly:

2.PNG

In the Format field, enter the querystring Key Value pair:

EntityAnalysisModelGUID=253e427e-4523-40d2-b155-fcd5348e20e9
3.PNG

Using the formats document, in this example, copy the Sample XML Account Financial Transaction section of the Formats document:

4.PNG

Pasting it into the Request code editor in the Postman page of Jube:

5.PNG

The code editor will parse the XML and give an indication of errors in structure. The message is now ready to be sent to the https://api.jube.io endpoint. Click the POST button:

6.PNG

The Postman page will simply relay the post to the https://api.jube.io endpoint as if it were being called from a programming environment or alternative HTTP post utility. The response will be written out to the response code editor:

7.PNG

The response XML is written out to the Response code editor, formatted as XML. Furthermore the response time is recorded, which is 6 milliseconds in this example, alongside the HTTP response status of 200 (success).

Refresh the page by navigating to Administration >>> HTTP Post Tools >>> Postman then proceed to repeat this process using JSON as follows.

Jube accepts both XML and JSON via the https://api.jube.io endpoint. Sending JSON messages is the same as XML, except the code editor would need to be changed to JSON by clicking on the radio button in the format section of the Postman page:

8.PNG

Although the switch is the same, a different value is used containing instructions on how to parse the JSON. In the formats field enter the querystring key value pair as follows:

EntityAnalysisModelGUID=7e5f96df-5a9b-4e13-a007-e02d79f970b3
9.PNG

This time, use the Sample JSON from the Account Financial Transaction section of the Formats document:

10.PNG

Pasting it into the Request code editor in the Postman page of Jube:

11.PNG

The code editor will parse the JSON and give an indication of errors in structure. The message is now ready to be sent to the https://api.jube.io endpoint. Click the POST button:

12.PNG

The response JSON is written out to the Response code editor, formatted as JSON.

It can be seen that Jube is able to accept both XML and JSON over the https://api.jube.io endpoint. The endpoint is described as being promiscuous in this regard and simply expects the the XML or JSON to be valid, and parse on receipt.

Make note that the structure of both XML and JSON is comprised of elements which can be referenced using XPath or JSON Path respectively.