ConfD User Community

Modern Web Framework development is possible like Angular or React?

Hi,

Conf-D Web REST API output will be in HTML template or Yang Model driven or JSON data driven?

If Yang model driven - then is possible to use Angular as Web Frame work for creating UI custom templates to convert Yang model XML response?

Or If Web API returns HTML output also - where we can write only css style.

Hello,

direct REST API is deprecated in current ConfD, and recent full ConfD releases (not included in basic) come with:

Similarly to a general “problem” of RPC vs REST selection question, both can be used for generic web interface programming, and selection depends on what are your requirements and wanted functionality…

Thanks to these APIs, basically any suitable framework can be picked according to your preferences… ConfD 7.4 comes with new example (examples.confd/json_rpc/webui) and shows a limited demo web-ui using JSON-RPC and Vue.JS front-end…

There is a bit more to that:

1 Like

Thanks,
So JSON RPC output will be in XML format or JSON ? So it possible to user Angular as web framework ?

Hello,

So JSON RPC output will be in XML format or JSON ?

for RESTCONF, it can be either XML and/or JSON.

For JSON-RPC API, it’s always JSON.

Request to ConfD:

$ curl http://127.0.0.1:8008/jsonrpc
  -c ./temp.cookie.curl
  -X POST 
  -H 'Content-Type: application/json'
  -d '{"jsonrpc": "2.0","id": 1,"method": "login","params": {"user":"admin","passwd":"admin"}}'

Response from ConfD:

{"jsonrpc":"2.0","result":{},"id":1}

Some next request:

$ curl http://127.0.0.1:8008/jsonrpc
  -b ./temp.cookie.curl
  -X POST
  -H 'Content-Type: application/json'
  -d '{"jsonrpc": "2.0","id": 2,"method": "new_trans","params": {}}'

and response:

{"jsonrpc":"2.0","result":{"th":1},"id":2}

etc.

So it possible to user Angular as web framework ?

i’m not web-dev professional myself, but imho sure, assuming it fits all customer’s requirements.

ConfD provides only the RESTCONF/JSON-RPC APIs to communicate and exchange data with web-application. it does NOT provides any HTML/styling etc. content. It’s completely up to customer to develop these using any preferred technologies (e.g. Angular, Ract, Vue.js, .or many others) of own choice.

Thanks for your reply , Also two more question.

Is JSON RPC works with pagination concept ? and also if we have 10000 records and if i would like to retrieve first 200 records with ascending/descending order - is possible ?

yes, either by direct methods parameter setting, or via customtized query xpaths (where it’s relevant - not for all methods), see ConfD user guide Chapter “The JSON-RPC API” that shows all the defined procedures and their parameters / return values etc.

For example generic API method start_query allows to define chunk size, sort order, field filtering, etc.