Restclient development

0

I am trying to access a rest service using Trestclient, Trestrequest and Trestresponse. the rest service calls back on port 8182  with a http post request that contains a body that has raw data as json.    How can I use Delphi to access the body content of the http Post.

Thanks 

Responses (2)
  • Accepted Answer

    Thursday, January 11 2018, 10:38 PM - #Permalink
    0

    If possible work this out using REST Debugger either in IDE or standalone.

    It will be faster than hooking up components. If you get the result dataset, then I would start with REST components. Not knowing at which phase in the development you are having trouble, if you can work your way around the Indy Http component. I would build my request using those component to get the syntax of the call correct, then begin with REST components. My biggest problem when beginning with the REST components was getting the syntax of the call correct. What I found was this is one of those areas you need to work some of the mechanics out for yourself, as a lot of the calls to services are slightly different. I f you decide to experiment using Indy components, use an IdLogFile component as this will capture the communication to/from the server even when the call fails, much easier for debugging. This was my learning tool, when at first I could not figure-out the REST Component set.

    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 11 2018, 09:42 AM - #Permalink
    0

    Probably you need

    RestRequest.Body

    to read the request's body and

    RestRequest.AddBody("Body Text")

    to add data to the request's body. Also there are several overloads of AddBody method, so check it and choose the most appropriate for you.

    The reply is currently minimized Show
Your Reply

Please login to post a reply