#1 2022-02-23 00:06:19

wsd
Member
Registered: 2022-02-22
Posts: 2

Confusion with 06 - Remote JSON Rest Service

Hi,

I'm wanting to write a very basic JSON Rest Service, where a 3rd party client can send through a JSON table, and then I can respond with a result that will be a separate JSON table of data. (No actual databases involved).

I checked out the 06 - Remote JSON REST Service example, but could not find any examples of JSON payload being used, just parameters being passed in the original URL.

My hope is to be able to imitate an external client and post a JSON table using Postman for the external client for testing. (I won't be using any database at all with this - just want to get JSON data, process it and return a result at this stage).

I've written a few basic REST clients in the past, and am now trying to step into writing a server side service and feel out of my depth at the moment - I'm not even sure if mORMot is the correct tool for me yet or if it's only designed for developers who are writing both the client and server side, and was looking for advise please. Is there a demo available that shows this functionality, or am I trying to use mORMot for a use it was never intended to be used for?

Thanks & Regards

Adam

Last edited by wsd (2022-02-23 01:53:02)

Offline

#2 2022-02-23 08:51:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Confusion with 06 - Remote JSON Rest Service

I guess the easiest in your case is to create an interface-based service.

Input POST will be parsed, and the JSON object fields will fill the method parameters.

See the documentation about it, especially how JSON is transmitted.
https://synopse.info/files/html/Synopse … #TITLE_460

Offline

#3 2022-02-27 22:15:55

wsd
Member
Registered: 2022-02-22
Posts: 2

Re: Confusion with 06 - Remote JSON Rest Service

Thank you very much. I'll check this out and see if I can get my head around it. I really appreciate the point in the right direction!

Out of curiosity - just wondering why the demo is labelled JSON when there's no JSON packet involved, or is it also JSON and there's something I'm misunderstanding?

Last edited by wsd (2022-02-28 00:14:37)

Offline

Board footer

Powered by FluxBB