For post and put methods, this can be done using requestBody, but i have filters and want to add some examples.
{{url}}/api/method?filter[qweqwe]=Test
Related
What is a brief explanation of the OpenAPI?
I read the documentation, and watched some tutorials, but didn't get the idea
It is basically a documentation of APIs. We can add the url, response, body, params etc for all methods like GET, POST, PUT, DELETE etc and for all the responses 200, 500 etc.
Refer https://swagger.io/docs/specification/about/
In SpringDoc, you can use #Parameter to add descriptions and additional information for a query parameter. However, there doesn't appear to be a straightforward way to do it for parameters within a request body, especially for POST and PUT requests.
Is there a way to do this via annotations or is this a non-supported feature?
Apply #Schema to your request body object in the individual fields.
How can I find what type of REST call it is i.e., PUT, POST, GET from the global variable?
You should be able to use the following suite of methods on the request object which is available from the controller: #get?, #post? , etc...
You can look here for more details: http://api.rubyonrails.org/classes/ActionDispatch/Request.html
You can also do the following within the controller: request.request_method, which returns 'GET', 'POST', etc...
Would it not be in the Network tab of your browser's javascript console?
I'm writing some functional tests for a POST API endpoint. I've reviewed the documentation and can't find a way to add content to the POST body. The post method for sfBrowser:
post('some url',array('x'=>'y'))
Only creates POST parameters (in this case x=y). Is there anyway of adding content to the post body using sfBrowser?
From what I have found here, here and here, the POST format takes parameter:value format, so you can send your JSON with some code like:
post('some url', array('json_data' => json_encode($toJson))
and then decode in your action with
$jsonObj = json_decode($request->getParameter('json_data'));
but you need to associate your JSON data with a parameter name in your POST to retrieve it on the server side.
As a side note, after looking at the Symfony code, the parameters are given straight to $_POST except for CSRF, which is tweaked.
I am using "/reader/api/0/stream/items/ids" API to get the item ids for sources that I want.
I have quite a number of sources, so I repeated "s=" parameter to include in the api url.
However, google has given me an error of "URL is too long".
So the question is that How can I solve it so that I just use one time api call to get item ids for that many sources?
Thanks
It seems that /reader/api/0/stream/items/ids path supports a POST method. This means the amount of data you could pass by using POST verb is much more than by using a query string and a GET method.
So use https://www.google.com/reader/api/0/stream/items/ids URL for the post, and pass your query string as a post data. Don't forget to include an action token(T) which is required for POST requests.