Rest API issues

Hi all,

Have a whale of a time trying to get my first REST service set up.
I've moved away from ASPRunner (which was so very easy to set up consuming REST api) and can't get my head around the RadZen way or the short tutorial on docs site.

Scenario: I enter vehicle Registration plate into a field and use this as a parameter in the query string to return the following Json result:

For the life of me, I cannot get the schema set up to work.
For the life of me I cannot figure out how to get my query string set up to accept the "plate" parameter for the lookup!

Please help....

What seems to be the problem? You need to define a Schema for your model. Nested complex properties need a new schema (e.g. idh, header, vehicle). Here is an example for some of those:

ApiResult is the "root" model that will be used as the response of your API (more a bit later). Notice it has an idh property which is of type IDH which is another schema. IDH itself has plate and response_version as well as header and vehicle which are complex objects hence need a schema of their own - Header and Vehicle. You can specify only the properties you would use in your application.

You define a query parameter of your API method (specified via the In dropdown)

Also notice that the Response is set to be of ApiResult schema which we defined earlier.

We have defined a getPlate method which performs a HTTP GET request to /plates?plate=<value> and returns an instance of the ApiResult schema on success (HTTP Status 200).

Find attached a sample Radzen Angular application which I created for taking the screenshots. (103.9 KB)

1 Like

Thank you. Seeing the schema in context made it "click". Appreciated.

I'm learning my way around Radzen, I'm sorry.
Following instructions on docs:
Step3 Create new page, point 2 create page property - cannot find where to do this.

You can check the Properties article from the Fundamentals section. It shows how to work with properties.

1 Like

Thanks. now I have a slightly different issue - default result from api is xml.
the query url should be: ?plate=&basic=1&f=json
how can I append the &basic=1&f=json to the query string?

By defining additional query parameters to your operation (check my second screenshot).