Hubway Connect can allow Business Analysts, Quality Assurance and Support Teams securely access OutSystems data. This opens up a plethora of opportunities to explore and analyse data, which can massively simplify the process of testing and troubleshooting.ย Hubway Connect also allows you to secure your data for Read and Write based on usersโ roles and permissions and their business-need-to-know level.
Let’s see how this works
In this step-by-step guide, we will show you how to use Hubway Connect to read and write data from an OutSystems Database through Postman, in a no-code style, with no need to go through a development lifecycle.
For this demonstration, we will use theย Order Managementย sample app, available in OutSystems Forge. The Order Management application is a mini CRM that can be used to control the process of receiving, tracking and fulfilling customer orders. We are assuming this Forge application has been installed in your OutSystems environment, including all the Entities listed within. By the end of this demonstration, we will have set up a Postman request to read data from the OrderItem table and update the Discount for a specific OrderItem Id.
Setup Hubway Connect project to support Read and Write
To enable a Hubway service to allow writing data into an Entity, go to the security tab of the Project Details page and ensure that the Authorisation type is โRead and Writeโ.
GET OutSystems Entity data using Hubway Connect within Postman
From Hubway Builder, you can get either the Generic URL or the Version specific URL for the GET requests.
Create a new request in Postman. Select the GET method from the dropdown and paste the service link in. Suffix the URL with the name of the Entity from which you want to fetch data.
Taking Order Management as an example, Let us assume that we want to fetch all the OrderItem.
Example:ย <Test or Production service link of the service>/OrderItem
https://yourdomain.outsystemsenterprise.com/HW/rest/odata/sales-order/OrderItem
Go to the Authorisation tab, select Type = Basic Auth and enter your OutSystems credentials. Hit the send button.
Postman will connect to Hubway service, fetch the OrderItem items and display them as a JSON. You could also apply theย OData methodsย like filter, search, expand, etc. to refine the data output further.
Insert data into OutSystems Entity using Hubway Connect and Postman
Find the EntityType
First step is to note down the EntityType of the Entity to which you are going to insert data. You can get this by launching the metadata URL in a new Postman request.
Metadata URL: <Test or Production service link>/$metadata
For example:ย https://yourdomain.outsystemsenterprise.com/HW/rest/odata/sales-order/$metadata
The first section in the response will give the EntityType for each Entity.
How to construct the POST request
Next step is to construct your POST request in Postman.
To create a new request in Postman, select the POST method from the dropdown and paste the Hubway service link. Suffix the URL with the name of the Entity into which you want to write data.
Taking Order Management as an example, let us assume that you want to insert a record into the OrderItem Entity. The URL will be for example:ย <Test or Production service link>/OrderItem
For example:ย https://yourdomain.outsystemsenterprise.com/HW/rest/odata/sales-order/OrderItem
Go to the Authorisation tab, select Type = Basic Auth and enter your OutSystems credentials.
Go to the Body tab and type the attributes and values in JSON format, to insert a record into the Entity. See the example below:
{ "@odata.type":"OrderManagement_CS.OrderItem", "OrderId": 2, "ProductId": 1, "Quantity": 10, "Discount": 20, "Amount": 500.00, "CreatedBy": 16, "CreatedOn": "2021-11-27T08:21:11+00:00", "UpdatedBy": 16, "UpdatedOn": "2021-11-27T08:21:11+00:00", "IsActive": true }
Note that in the first line of the JSON statement above, we have prefixed theย EntityTypeย โOrderManagement_CSโ to OrderItem. Then hit the Send button.
Postman will connect to Hubway service and insert the record into the OrderItem Entity. The response will give you the Id of the newly inserted record.
You could verify if your insert went through fine by doing a GET request on the OrderItem Entity.
Update data in an OutSystems Entity using Hubway Connect and Postman
First step is to note down the EntityType of the Entity to which you are going to insert data. Referย Find the EntityType.
Construct the PUT request
Next step is to construct your PUT request in Postman.
Create a new request in Postman. Select the PUT method from the dropdown and paste the Test or Production service link from Hubway. Suffix the URL with the name of the Entity in which you want to update a record along with the Id of that record.
Taking Order Management as an example, let us assume that you want to update a record into the OrderItem Entity.
The URL will be:ย <Test or Production service link>/OrderItem(<Id of the OrderItem that needs to be updated>)
For example:ย https://yourdomain.outsystemsenterprise.com/HW/rest/odata/sales-order/OrderItem(1)
Go to the Authorisation tab, select Type = Basic Auth and enter your OutSystems credentials.
Go to the Body tab and type the JSON to update record values into the Entity. See example below:
{ "@odata.type":"OrderManagement_CS.OrderItem", "Discount": 20, "IsActive": true }
Note that in the first line of the JSON statement above, we have prefixed the EntityType โOrderManagement_CSโ to OrderItem.
Then hit the Send button.
Postman will connect to Hubway service and update the record in the OrderItem Entity. You could verify if your update went through by doing a GET request on the OrderItem Entity.
Delete data from an OutSystems Entity using Hubway Connect within Postman
Create a new request in Postman. Select the DELETE method from the dropdown and paste the Test or Production service link from Hubway. Suffix the URL with the name of the Entity from which you want to delete data along with the Id of the record.
Taking Order Management as an example, let us assume that you want to delete a record into the OrderItem Entity.
The URL will be:ย <Test or Production service link>/OrderItem(<Id of the OrderItem that needs to be deleted>)
For example:ย https://yourdomain.outsystemsenterprise.com/HW/rest/odata/sales-order/OrderItem(1)
Go to the Authorisation tab, select Type = Basic Auth and enter your OutSystems credentials
Then hit the Send button.
Postman will connect to Hubway service and delete the record from the OrderItem Entity. You could verify if your delete went through fine by doing a GET request on the OrderItem Entity. No record will be returned as the record was deleted from the Entity.
Unlimited possibilities
Similar to Postman, we can use several alternative tools that are available to send requests to the Hubway OData service. Hubway Connect enables quick and easy access to data for troubleshooting, testing and quick data correctionโฆ all without the need to write one line of code.