Jump to content
al17nichols

rest json, RestRequest

Recommended Posts

I have a url, parameters that I want to sent do an endpoint with the post command and receive a response token.  I placed the url in the restclient with the endpoint as https://bbb.domainx.com/v31/api/auth.  I added individual parameters.  I assigned the method as rmpost ( i tried it as rmget ) in neither case did it work.  I receive 404 Not found.  Anybody know what I am doing wrong?  Also. how can I find the resulting json that is being sent to the website (for trouble shooting purposes)?

Share this post


Link to post

When I test it, GET method redirects to URL https://qws.quartix.com/v2/api/auth and respond with "{"Message":"The requested resource does not support http method 'GET'."}" There is no 404 error.

 

I have tried to use TRESTRequest and other relevant components in the past. I got a memory leak that had to be fixed by Embarcadero. After that incident, I directly communicate using HTTP component of my choice.

 

You should have a swagger or postman document or a web link for explanation of endpoints. You also should have some test environment credentials in order to be able to build your integration. I could not see any publicly available API information. You probably need to apply for it.

 

Share this post


Link to post

I have the parameters you described, but I received response that it does not support method get.  I have the mentioned credentials and supplied them as parameters to the trestrequest component with the parameters method property set as rm post.

 
   
Message "The requested resource does not support http method 'GET'."

Share this post


Link to post

I managed to solve this by correcting the a few of the properties and now I received the expected results.  My remaining question is how do I know that exact statements are sent to the server?  Is there a way to know what XML, JSON are we submitting to the endpoint?

Share this post


Link to post

You can get the complete URL from TRESTRequest.GetFullRequestURL and the payload from TRESTRequest.Params.ParameterByName('body').Value (check for a nil parameter in case there is no body at all)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×