Document POST body example
See original GitHub issueAfter a bunch of experimentation, I figured out that you can use a POJO as a POST body, but I couldn’t find it anywhere in the documentation. e.g. You can do
public interface Boop {
@RequestLine("POST /boop/{someParam}")
@Headers({
"Accept: application/json",
"Content-Type: application/json"
})
BoopResponse createBoopUsingPOST(Boop boop, @Param("someParam") String someParam);
class Boop {
public String value;
}
}
But the tricky part is that the POJO param (boop
, in the example), must come first in the parameter list of the method. That was difficult to find out!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Describing Request Body - Swagger
Request bodies are typically used with “create” and “update” operations (POST, PUT, PATCH). For example, when creating a resource using POST or PUT,...
Read more >Add a Request Body to a POST Request | API Connector
Enter a Request Body As part of a POST, PUT, or PATCH request, a data payload can be sent to the server in...
Read more >POST - HTTP - MDN Web Docs
The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header....
Read more >Request Body - FastAPI
A request body is data sent by the client to your API. ... For example, this model above declares a JSON " object...
Read more >How do I post request body with Curl? - ReqBin
Click Run to execute Curl POST Body example online and see results. ... The HTTP POST method is used to upload files and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@wulftone
Thanks for this example. It is missing from the documentation. You can define the body of the request two ways:
@Body
Body
We should update the documentation to explain this and add you example.
@sleroy hoped the example would be sufficient
How should we improve it?