I'm using (and new to) Symfony 3 and NelmioApiDocbundle. I want to handle a POST request that has optional query parameters. The url would be something like: http://example.com/api/updateusers?token=some_long_value
This is what I've tried for my annotations:
/**
* Returns a JSON object.
*
* @ApiDoc(
* resource=true,
* description="Update a user's information.",
* requirements={
* {
* "name"="userid",
* "dataType"="string",
* "requirement"=".+",
* "description"="the user to update"
* }
* },
* parameters={
* {"name"="data", "dataType"="text area", "required"=true, "description"="Free form xml data."}
* },
* filters={
* {"name"="token", "dataType"="string", "required"=true, "description"="auth token for current user - user that you're making the request on behalf of."},
* },
* )
* @Route("api/updateusers")
* @Method("POST")
*/
Requirements, parameters, and filters are all showing up in the POST body in the API sandbox. Is there another definition type that I can use that will show a query parameter in the API sandbox? If I bypass the sandbox and send the request directly to the server, the token shows up properly as a GET value. But I'd like to be able to use the API sandbox for testing and documentation.
Try to add this in your annotations, hope it helps you.