You are not logged in.
Pages: 1
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
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
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
Pages: 1