REST web service

Hi. I’m a bit uncertain how to use your product to connect to a REST web service that does not require authentication.

URL: http://xyz.com/applications/getAPMEnquiryBlCharges.php Parameters and Values: bilno=ZIMUNYC923947 AND storageto=20170718

If I enter http://xyz.com//applications/getAPMEnquiryBlCharges.php?bilno=ZIMUNYC923947&storageto=20170718 in my browser I get the expected response

Here are the settings that I’m using in RADZEN:

REST endpoint - http://xyz.com/applications/getAPMEnquiryBlCharges.php
SCHEMA: I’ve added three properties to represent the data that should be returned
RESOURCE: Not sure what values to enter here for resource name and method. Should I enter bilno and storageto as parameters?

Thanks for your assistance.

Regards
Albert

Hi Albert,

Please try the following:

1.Set the REST endpoint to http://xyz.com/applications
2. Add the schema as you did
3. Add a resource getAPMEnquiryBlCharges.php.
4. Define a GET operation named getAPMEnquiryBlCharges.
5. Add the bilno and storageto parameters
6. Add a response for the 200 code and pick the schema you defined in step 2.

Let me know how it goes!

Hi Korchev.

Thanks for your response.

I’ve configured the REST services based on your instructions. I’ve also done the following:

  1. Add a new page called Charges.
  2. Create a new page property called charges
  3. Add new handler of the page Load event.
  4. Set Type to Invoke data source method.
  5. Set Name to getAPMEnquiryBlCharges.
  6. Add Then handler.
  7. Set Type to Set property.
  8. Set Name to releases.
  9. Set Value to ${result.charges.items}.

However, I added the data grid but I am not seeing the properties box so I set any properties or add any columns.

Regards
Albert

Can zip the meta directory of your Radzen app and attach it here? The steps seem correct. The Data dropdown may remain empty if Radzen couldn’t determine the type of the items property or it isn’t array.

Hi. Please see below. I cannot upload zipped files:

…\meta\pages\charges.json
{
“access”: “Everybody”,
“components”: [
{
“col”: 12,
“data”: “”,
“name”: “grid0”,
“row”: 0,
“section”: null,
“type”: “grid”
}
],
“events”: {
“load”: [
{
“name”: “getCharges.getAPMEnquiryBlCharges”,
“parameters”: [
{}
],
“then”: [
{
“name”: “charges”,
“type”: “set”,
“value”: “${result.charges.items}”
}
],
“type”: “invoke”
}
]
},
“name”: “Charges”
}

Regards
Albert

The page meta looks correct - nothing suspicious. Can you paste here how a typical response from getAPMEnquiryBlCharges looks like? Just paste the JSON here.

In addition you could paste the contents of the \meta\data\getCharges.json file (you can remove the URL to keep things private).

Here goes…

Response from getAPMEnquiryBlCharges
{
“error”: [],
“data”: {
“charge”: [
“Storage - Container”,
“Storage - Container”
],
“amount”: [
156800,
156800
],
“rcdcnt”: 2
},
“storagedue”: “12/04/2017”
}

getCharges.jjson
{
“basePath”: “/apm/applications/”,
“definitions”: {
“chargeslist”: {
“properties”: {
“Charge Amount”: {
“format”: “float”,
“type”: “number”
},
“Description”: {
“type”: “string”
},
“Storage to”: {
“format”: “date”,
“type”: “string”
}
}
}
},
“host”: “10.240.6.45:81”,
“info”: {
“title”: “getCharges”,
“x-type”: “rest”
},
“paths”: {
“chargeResource”: {
“get”: {
“operationId”: “resourceParameter”,
“parameters”: [
{
“in”: “path”,
“name”: “bilno”,
“type”: “string”
},
{
“in”: “path”,
“name”: “storageto”,
“type”: “string”
}
],
“responses”: {
“200”: {
“schema”: {
“$ref”: “#/definitions/chargeslist”
}
}
}
}
},
“getAPMEnquiryBlCharges.php”: {
“get”: {
“operationId”: “getAPMEnquiryBlCharges”,
“parameters”: [
{
“in”: “path”,
“name”: “bilno”,
“type”: “string”
},
{
“in”: “path”,
“name”: “storageto”,
“type”: “string”
}
],
“responses”: {
“200”: {
“schema”: {
“$ref”: “#/definitions/chargeslist”
}
}
}
}
}
},
“schemes”: [
“http”
]
}

Hi Albert,

Thanks for providing the data source definition and response. I see what the problems are.

  1. You have configured the property to be set to ${result.charges.items} however the response doesn’t seem to contain a charges property. It contains data, error and storagedue. You must specify a valid property from the response.
  2. The response schema of the getAPMEnquiryBlCharges operation is set to chargeslist which has properties called ‘Charge Amount’ and ‘Storage to’. Those properties don’t seem to be present in the sample server response.

When configuring a Radzen REST data source one should describe the Schema exactly as the server response is. Omitting certain properties is OK as long as you are not going to use them in the Radzen app.