how to call a REST server with JSON (without RO) with parameters (ComplexType) using the remobjects (client RO) in delphi
Is there an example?
For example, I have a third party service that receives a record (name, address, age, sex) in JSON and I want to send and also receive a data structure (code, message) in response.
But how do you call the method? Because with soap we have the wsdl to write the interface and call (ROServerRequest as IServiceTest) .Sum (x + y), but with JSON we do not have the service interface.
Megademo also uses the service interface developed with Remobjects.
could you make a small test (delphi) consumed a JSON service? https://viacep.com.br/ it offers a service of ZIP in the following url: viacep.com.br/ws/01001000/json/ that returns the following structure:
RO client uses POST method for communication with RO services
in your case, GET method should be used.
I can recommend to use native Indy (TIdHTTP) or Synapse (THTTPSend) classes for sending GET request.
it can be like IdHTTP.Get(..) or HTTPSend.HTTPMethod('GET',..)
Create JSON request you can with classes from uROJSONParser.pas unit
The RO server expects that in the body of the message has the method it will be calling, is this a JSON mensen pattern or is it a RO standard to work on?
My test was as follows: I have a no-RO client to consume an RO service. I used MegaDemoServer and as a PostMan Client-Client (https://github.com/postmanlabs/postman-app-support/wiki). I made a POST call passing the same message generated by MegaDemoClient and I’m not getting it to work.
How is a standard JSON RO, how do I for my customer working with JSON, send a JSON in RO standard? If it’s a RO-specific JSON this makes it difficult to integrate with a customer who does not know RO, do not you think?