BSL and Postman

The Beas Service Layer supports ODATA versions 2, 3 and 4 with limited compatibility. Some functions are not available, but additional functions help create applications.

 

Requirements

Beas WEB Sever

Postman (or another tool)
youtube How to work with postman

Knowledge in using ODATA

 

Process

1.Start the Beas WEB Server in Beas Tools>WEB Server.

webserver

2.Activate "Disable Authorization" or see authorization.

3.Download and start Postman (https://www.getpostman.com/downloads/).

4.Insert the correct URL in Postman.

ODataUri

Scheme: http

Host: The IP-Address, in this example: 192.168.178.64

Port: The Port, in this example: 8080

Service Root: Use odata2, odata3 or odata4

ResourcePath/Options: The resource and query options

5.Test the connection (insert your IP/Port-Address) + "odata4" + the command, for example "$metadata":

postman

 

Examples using ODATA with the Beas Service Layer

Example

Result

Item("A001")

Returns all fields from Item A001

Item("A001")/ItemName

Returns only the ItemName in the defined format

Item("A001")/ItemName/$value

Returns only the ItemName in text format

Item()

Returns all fields for all items

Item("A001")?$select=ItemCode,ItemName

Returns the ItemCode and ItemName fields for item A001

Item("A001")?$select=ItemCode,ItemWareHouse&$expand=ItemWareHouse

Returns all warehouse information as a sub-structure for item A001

{"ItemCode":"A001",ItemWareHouse:[
  {"WhsCode":"01","OnHand":10.5}
  {"WhsCode":"02","OnHand":5.3}
  ]
}

Item("A001")?select=ItemCode,ItemWareHouse/WhsCode,ItemWareHouse/OnHand

Difference: There is no $expand function inside the command, which makes this command ~20% faster per result line.

Returns all warehouse information in a flat JSON file

{"ItemCode":"A001","WhsCode":"01","OnHand":10.5},
{"ItemCode":"A001","WhsCode":"02","OnHand":5.3}

Item("A001")?select=ItemCode,ItemWareHouse/WhsCode,ItemWareHouse/OnHand&$expand=ItemWareHouse&$format=jsonarray

Returns all warehouse information in a flat JSON file

["A001","01",10.5],["A001","02",5.3]

 

HTTP Header

From the client:

Keyword

Description

accept

text/html

application/xml, appication/xhtml+xml, xml

application/json, json

 

Beas always uses the last defined format.

In this example Beas uses the JSON format:

accept=application/atom+xml,application/json

 

There is currently no metadata support

accept-charset

Not supported. Beas always uses udf-8.

accept-encoding

Not supported.

accept-language

Accepted language. Current only en-US is accepted.

authorization

Currently not supported.

Cache-Control

Beas does not work with a cache system in the ODATA protocol.

youtube How to work with postman