I have the following method I want to test using PostMan
public returnType name( String var1, String var2,String var3, String var4);
I tried to send a post request to test I sent one like this but it does not work:
{
"var1": "GU4777",
"var2" : "HU 888",
"var3" : "NU 8890",
"var4" : "UJ 9909"
}
Can you guys please tell me the exact syntax I can use?
Thank you in advance;
CodePudding user response:
Rest API
In order to do what you want to do you first need a HTTP server that listens for requests on a certain endpoint let's call that endpoint /test
.
The server then must parse the JSON request body when it receives the request, extract the parameters and can then call the method name()
using those parameters.
Here an implementation of a server like this using JavaScript and
On the server side you can observe this:
RPC/ gRPC
In order to "directly" invoke a function on a server you might wanna have a look at RPC or gRPC for your preferred language.